From a4ff07c06cd0d4a9091cc4a550883697af09eb34 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 1 Jul 2019 17:36:13 -0400 Subject: [PATCH] [#14213] - Refactored Db/Mvc abstract classes --- .../AbstractDialect.zep} | 7 ++- phalcon/Db/{ => Dialect}/DialectInterface.zep | 2 +- phalcon/Db/Dialect/Mysql.zep | 6 +- phalcon/Db/Dialect/Postgresql.zep | 8 +-- phalcon/Db/Dialect/Sqlite.zep | 6 +- .../AbstractController.zep} | 10 ++-- phalcon/Mvc/Controller/BindModelInterface.zep | 4 +- .../{ => Controller}/ControllerInterface.zep | 4 +- phalcon/Mvc/Dispatcher.zep | 2 +- phalcon/Mvc/DispatcherInterface.zep | 2 +- phalcon/Mvc/Micro.zep | 4 +- phalcon/Mvc/Model.zep | 6 +- .../AbstractBehavior.zep} | 8 +-- .../{ => Behavior}/BehaviorInterface.zep | 4 +- phalcon/Mvc/Model/Behavior/SoftDelete.zep | 4 +- phalcon/Mvc/Model/Behavior/Timestampable.zep | 4 +- phalcon/Mvc/Model/Manager.zep | 2 +- phalcon/Mvc/Model/ManagerInterface.zep | 2 +- .../AbstractMetaData.zep} | 60 +++++++------------ phalcon/Mvc/Model/MetaData/Apcu.zep | 6 +- phalcon/Mvc/Model/MetaData/Enum.zep | 31 ++++++++++ phalcon/Mvc/Model/MetaData/Libmemcached.zep | 8 +-- phalcon/Mvc/Model/MetaData/Memory.zep | 4 +- .../{ => MetaData}/MetaDataInterface.zep | 2 +- phalcon/Mvc/Model/MetaData/Redis.zep | 6 +- .../Model/MetaData/Strategy/Annotations.zep | 26 ++++---- .../Model/MetaData/Strategy/Introspection.zep | 26 ++++---- phalcon/Mvc/Model/MetaData/Stream.zep | 6 +- phalcon/Mvc/ModelInterface.zep | 2 +- 29 files changed, 129 insertions(+), 133 deletions(-) rename phalcon/Db/{Dialect.zep => Dialect/AbstractDialect.zep} (99%) rename phalcon/Db/{ => Dialect}/DialectInterface.zep (99%) rename phalcon/Mvc/{Controller.zep => Controller/AbstractController.zep} (83%) rename phalcon/Mvc/{ => Controller}/ControllerInterface.zep (83%) rename phalcon/Mvc/Model/{Behavior.zep => Behavior/AbstractBehavior.zep} (91%) rename phalcon/Mvc/Model/{ => Behavior}/BehaviorInterface.zep (90%) rename phalcon/Mvc/Model/{MetaData.zep => MetaData/AbstractMetaData.zep} (92%) create mode 100644 phalcon/Mvc/Model/MetaData/Enum.zep rename phalcon/Mvc/Model/{ => MetaData}/MetaDataInterface.zep (99%) diff --git a/phalcon/Db/Dialect.zep b/phalcon/Db/Dialect/AbstractDialect.zep similarity index 99% rename from phalcon/Db/Dialect.zep rename to phalcon/Db/Dialect/AbstractDialect.zep index 90a8470f554..ffcc673d4ec 100644 --- a/phalcon/Db/Dialect.zep +++ b/phalcon/Db/Dialect/AbstractDialect.zep @@ -8,13 +8,16 @@ * file that was distributed with this source code. */ -namespace Phalcon\Db; +namespace Phalcon\Db\Dialect; + +use Phalcon\Db\Exception; +use Phalcon\Db\ColumnInterface; /** * This is the base class to each database dialect. This implements * common methods to transform intermediate code into its RDBMS related syntax */ -abstract class Dialect implements DialectInterface +abstract class AbstractDialect implements DialectInterface { protected escapeChar; diff --git a/phalcon/Db/DialectInterface.zep b/phalcon/Db/Dialect/DialectInterface.zep similarity index 99% rename from phalcon/Db/DialectInterface.zep rename to phalcon/Db/Dialect/DialectInterface.zep index 7a3f7c64932..f5b70c31ce8 100644 --- a/phalcon/Db/DialectInterface.zep +++ b/phalcon/Db/Dialect/DialectInterface.zep @@ -8,7 +8,7 @@ * file that was distributed with this source code. */ -namespace Phalcon\Db; +namespace Phalcon\Db\Dialect; use Phalcon\Db\ColumnInterface; use Phalcon\Db\ReferenceInterface; diff --git a/phalcon/Db/Dialect/Mysql.zep b/phalcon/Db/Dialect/Mysql.zep index ceb28a705f5..de3798af59c 100644 --- a/phalcon/Db/Dialect/Mysql.zep +++ b/phalcon/Db/Dialect/Mysql.zep @@ -10,18 +10,18 @@ namespace Phalcon\Db\Dialect; -use Phalcon\Db\Dialect; +use Phalcon\Db\Dialect\AbstractDialect; use Phalcon\Db\Column; use Phalcon\Db\Exception; use Phalcon\Db\IndexInterface; use Phalcon\Db\ColumnInterface; use Phalcon\Db\ReferenceInterface; -use Phalcon\Db\DialectInterface; +use Phalcon\Db\Dialect\DialectInterface; /** * Generates database specific SQL for the MySQL RDBMS */ -class Mysql extends Dialect +class Mysql extends AbstractDialect { /** * @var string diff --git a/phalcon/Db/Dialect/Postgresql.zep b/phalcon/Db/Dialect/Postgresql.zep index d636ff9cafd..88447b816f2 100644 --- a/phalcon/Db/Dialect/Postgresql.zep +++ b/phalcon/Db/Dialect/Postgresql.zep @@ -10,18 +10,18 @@ namespace Phalcon\Db\Dialect; -use Phalcon\Db\Dialect; use Phalcon\Db\Column; +use Phalcon\Db\ColumnInterface; +use Phalcon\Db\Dialect\AbstractDialect; +use Phalcon\Db\Dialect\DialectInterface; use Phalcon\Db\Exception; use Phalcon\Db\IndexInterface; -use Phalcon\Db\ColumnInterface; use Phalcon\Db\ReferenceInterface; -use Phalcon\Db\DialectInterface; /** * Generates database specific SQL for the PostgreSQL RDBMS */ -class Postgresql extends Dialect +class Postgresql extends AbstractDialect { /** * @var string diff --git a/phalcon/Db/Dialect/Sqlite.zep b/phalcon/Db/Dialect/Sqlite.zep index 8793b47cc60..3b721eb894e 100644 --- a/phalcon/Db/Dialect/Sqlite.zep +++ b/phalcon/Db/Dialect/Sqlite.zep @@ -13,15 +13,15 @@ namespace Phalcon\Db\Dialect; use Phalcon\Db\Column; use Phalcon\Db\Exception; use Phalcon\Db\IndexInterface; -use Phalcon\Db\Dialect; -use Phalcon\Db\DialectInterface; +use Phalcon\Db\Dialect\AbstractDialect; +use Phalcon\Db\Dialect\DialectInterface; use Phalcon\Db\ColumnInterface; use Phalcon\Db\ReferenceInterface; /** * Generates database specific SQL for the SQLite RDBMS */ -class Sqlite extends Dialect +class Sqlite extends AbstractDialect { /** * @var string diff --git a/phalcon/Mvc/Controller.zep b/phalcon/Mvc/Controller/AbstractController.zep similarity index 83% rename from phalcon/Mvc/Controller.zep rename to phalcon/Mvc/Controller/AbstractController.zep index 77ebcf71a3f..329a9ee42c1 100644 --- a/phalcon/Mvc/Controller.zep +++ b/phalcon/Mvc/Controller/AbstractController.zep @@ -8,13 +8,11 @@ * file that was distributed with this source code. */ -namespace Phalcon\Mvc; +namespace Phalcon\Mvc\Controller; use Phalcon\Di\Injectable; /** - * Phalcon\Mvc\Controller - * * Every application controller should extend this class that encapsulates all * the controller functionality * @@ -26,7 +24,7 @@ use Phalcon\Di\Injectable; *```php * readMetaDataIndex(model, self::MODELS_ATTRIBUTES); + let data = this->readMetaDataIndex(model, Enum::MODELS_ATTRIBUTES); if unlikely typeof data != "array" { throw new Exception("The meta-data is invalid or is corrupt"); @@ -111,7 +93,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface let data = this->readMetaDataIndex( model, - self::MODELS_AUTOMATIC_DEFAULT_INSERT + Enum::MODELS_AUTOMATIC_DEFAULT_INSERT ); if unlikely typeof data != "array" { @@ -138,7 +120,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface let data = this->readMetaDataIndex( model, - self::MODELS_AUTOMATIC_DEFAULT_UPDATE + Enum::MODELS_AUTOMATIC_DEFAULT_UPDATE ); if unlikely typeof data != "array" { @@ -165,7 +147,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface let data = this->readMetaDataIndex( model, - self::MODELS_DATA_TYPES_BIND + Enum::MODELS_DATA_TYPES_BIND ); if unlikely typeof data != "array" { @@ -190,7 +172,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface { var data; - let data = this->readColumnMapIndex(model, self::MODELS_COLUMN_MAP); + let data = this->readColumnMapIndex(model, Enum::MODELS_COLUMN_MAP); if unlikely (data !== null && typeof data != "array") { throw new Exception("The meta-data is invalid or is corrupt"); @@ -214,7 +196,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface { var data; - let data = this->readMetaDataIndex(model, self::MODELS_DEFAULT_VALUES); + let data = this->readMetaDataIndex(model, Enum::MODELS_DEFAULT_VALUES); if unlikely typeof data != "array" { throw new Exception("The meta-data is invalid or is corrupt"); @@ -238,7 +220,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface { var data; - let data = this->readMetaDataIndex(model, self::MODELS_DATA_TYPES); + let data = this->readMetaDataIndex(model, Enum::MODELS_DATA_TYPES); if unlikely typeof data != "array" { throw new Exception("The meta-data is invalid or is corrupt"); @@ -264,7 +246,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface let data = this->readMetaDataIndex( model, - self::MODELS_DATA_TYPES_NUMERIC + Enum::MODELS_DATA_TYPES_NUMERIC ); if unlikely typeof data != "array" { @@ -299,7 +281,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface let data = this->readMetaDataIndex( model, - self::MODELS_EMPTY_STRING_VALUES + Enum::MODELS_EMPTY_STRING_VALUES ); if unlikely typeof data != "array" { @@ -325,7 +307,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface */ public function getIdentityField( model) -> string { - return this->readMetaDataIndex(model, self::MODELS_IDENTITY_COLUMN); + return this->readMetaDataIndex(model, Enum::MODELS_IDENTITY_COLUMN); } /** @@ -343,7 +325,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface { var data; - let data = this->readMetaDataIndex(model, self::MODELS_NON_PRIMARY_KEY); + let data = this->readMetaDataIndex(model, Enum::MODELS_NON_PRIMARY_KEY); if unlikely typeof data != "array" { throw new Exception("The meta-data is invalid or is corrupt"); @@ -367,7 +349,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface { var data; - let data = this->readMetaDataIndex(model, self::MODELS_NOT_NULL); + let data = this->readMetaDataIndex(model, Enum::MODELS_NOT_NULL); if unlikely typeof data != "array" { throw new Exception("The meta-data is invalid or is corrupt"); @@ -391,7 +373,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface { var data; - let data = this->readMetaDataIndex(model, self::MODELS_PRIMARY_KEY); + let data = this->readMetaDataIndex(model, Enum::MODELS_PRIMARY_KEY); if unlikely typeof data != "array" { throw new Exception("The meta-data is invalid or is corrupt"); @@ -417,7 +399,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface let data = this->readColumnMapIndex( model, - self::MODELS_REVERSE_COLUMN_MAP + Enum::MODELS_REVERSE_COLUMN_MAP ); if unlikely (data !== null && typeof data != "array") { @@ -461,7 +443,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface return isset columnMap[attribute]; } - return isset this->readMetaData(model)[self::MODELS_DATA_TYPES][attribute]; + return isset this->readMetaData(model)[Enum::MODELS_DATA_TYPES][attribute]; } /** @@ -641,7 +623,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface { this->writeMetaDataIndex( model, - self::MODELS_AUTOMATIC_DEFAULT_INSERT, + Enum::MODELS_AUTOMATIC_DEFAULT_INSERT, attributes ); } @@ -662,7 +644,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface { this->writeMetaDataIndex( model, - self::MODELS_AUTOMATIC_DEFAULT_UPDATE, + Enum::MODELS_AUTOMATIC_DEFAULT_UPDATE, attributes ); } @@ -683,7 +665,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface { this->writeMetaDataIndex( model, - self::MODELS_EMPTY_STRING_VALUES, + Enum::MODELS_EMPTY_STRING_VALUES, attributes ); } diff --git a/phalcon/Mvc/Model/MetaData/Apcu.zep b/phalcon/Mvc/Model/MetaData/Apcu.zep index ecb31517bf4..8c1f94ecbd8 100644 --- a/phalcon/Mvc/Model/MetaData/Apcu.zep +++ b/phalcon/Mvc/Model/MetaData/Apcu.zep @@ -10,13 +10,11 @@ namespace Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\MetaData; +use Phalcon\Mvc\Model\MetaData\AbstractMetaData; use Phalcon\Mvc\Model\Exception; use Phalcon\Cache\AdapterFactory; /** - * Phalcon\Mvc\Model\MetaData\Apcu - * * Stores model meta-data in the APCu cache. Data will erased if the web server is restarted * * By default meta-data is stored for 48 hours (172800 seconds) @@ -32,7 +30,7 @@ use Phalcon\Cache\AdapterFactory; * ); *``` */ -class Apcu extends MetaData +class Apcu extends AbstractMetaData { /** * Phalcon\Mvc\Model\MetaData\Apcu constructor diff --git a/phalcon/Mvc/Model/MetaData/Enum.zep b/phalcon/Mvc/Model/MetaData/Enum.zep new file mode 100644 index 00000000000..cfe2a8d07dd --- /dev/null +++ b/phalcon/Mvc/Model/MetaData/Enum.zep @@ -0,0 +1,31 @@ + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ + +namespace Phalcon\Mvc\Model\MetaData; + +class Enum +{ + const MODELS_ATTRIBUTES = 0; + const MODELS_AUTOMATIC_DEFAULT_INSERT = 10; + const MODELS_AUTOMATIC_DEFAULT_UPDATE = 11; + const MODELS_COLUMN_MAP = 0; + const MODELS_DATE_AT = 6; + const MODELS_DATE_IN = 7; + const MODELS_DATA_TYPES = 4; + const MODELS_DATA_TYPES_BIND = 9; + const MODELS_DATA_TYPES_NUMERIC = 5; + const MODELS_DEFAULT_VALUES = 12; + const MODELS_EMPTY_STRING_VALUES = 13; + const MODELS_IDENTITY_COLUMN = 8; + const MODELS_NON_PRIMARY_KEY = 2; + const MODELS_NOT_NULL = 3; + const MODELS_PRIMARY_KEY = 1; + const MODELS_REVERSE_COLUMN_MAP = 1; +} diff --git a/phalcon/Mvc/Model/MetaData/Libmemcached.zep b/phalcon/Mvc/Model/MetaData/Libmemcached.zep index 3c86737294d..dae5944648d 100644 --- a/phalcon/Mvc/Model/MetaData/Libmemcached.zep +++ b/phalcon/Mvc/Model/MetaData/Libmemcached.zep @@ -12,22 +12,18 @@ namespace Phalcon\Mvc\Model\MetaData; use Phalcon\Helper\Arr; use Phalcon\Mvc\Model\Exception; -use Phalcon\Mvc\Model\MetaData; +use Phalcon\Mvc\Model\MetaData\AbstractMetaData; use Phalcon\Cache\AdapterFactory; /** - * Phalcon\Mvc\Model\MetaData\Libmemcached - * * Stores model meta-data in the Memcache. * * By default meta-data is stored for 48 hours (172800 seconds) */ -class Libmemcached extends MetaData +class Libmemcached extends AbstractMetaData { /** * Phalcon\Mvc\Model\MetaData\Libmemcached constructor - * - * @param array options */ public function __construct( factory, array! options = []) -> void { diff --git a/phalcon/Mvc/Model/MetaData/Memory.zep b/phalcon/Mvc/Model/MetaData/Memory.zep index d31e6a38d51..af5af4effcf 100644 --- a/phalcon/Mvc/Model/MetaData/Memory.zep +++ b/phalcon/Mvc/Model/MetaData/Memory.zep @@ -10,7 +10,7 @@ namespace Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\MetaData; +use Phalcon\Mvc\Model\MetaData\AbstractMetaData; use Phalcon\Mvc\Model\Exception; /** @@ -19,7 +19,7 @@ use Phalcon\Mvc\Model\Exception; * Stores model meta-data in memory. Data will be erased when the request finishes * */ -class Memory extends MetaData +class Memory extends AbstractMetaData { /** * Phalcon\Mvc\Model\MetaData\Memory constructor diff --git a/phalcon/Mvc/Model/MetaDataInterface.zep b/phalcon/Mvc/Model/MetaData/MetaDataInterface.zep similarity index 99% rename from phalcon/Mvc/Model/MetaDataInterface.zep rename to phalcon/Mvc/Model/MetaData/MetaDataInterface.zep index 7da62908156..e04a097127c 100644 --- a/phalcon/Mvc/Model/MetaDataInterface.zep +++ b/phalcon/Mvc/Model/MetaData/MetaDataInterface.zep @@ -8,7 +8,7 @@ * file that was distributed with this source code. */ -namespace Phalcon\Mvc\Model; +namespace Phalcon\Mvc\Model\MetaData; use Phalcon\Mvc\ModelInterface; use Phalcon\Mvc\Model\MetaData\StrategyInterface; diff --git a/phalcon/Mvc/Model/MetaData/Redis.zep b/phalcon/Mvc/Model/MetaData/Redis.zep index 71b8198f262..a50634af24c 100644 --- a/phalcon/Mvc/Model/MetaData/Redis.zep +++ b/phalcon/Mvc/Model/MetaData/Redis.zep @@ -10,12 +10,10 @@ namespace Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\MetaData; +use Phalcon\Mvc\Model\MetaData\AbstractMetaData; use Phalcon\Cache\AdapterFactory; /** - * Phalcon\Mvc\Model\MetaData\Redis - * * Stores model meta-data in the Redis. * * By default meta-data is stored for 48 hours (172800 seconds) @@ -34,7 +32,7 @@ use Phalcon\Cache\AdapterFactory; * ); *``` */ -class Redis extends MetaData +class Redis extends AbstractMetaData { /** * Phalcon\Mvc\Model\MetaData\Redis constructor diff --git a/phalcon/Mvc/Model/MetaData/Strategy/Annotations.zep b/phalcon/Mvc/Model/MetaData/Strategy/Annotations.zep index d5d30de2793..1c0f7601e3f 100644 --- a/phalcon/Mvc/Model/MetaData/Strategy/Annotations.zep +++ b/phalcon/Mvc/Model/MetaData/Strategy/Annotations.zep @@ -13,7 +13,7 @@ namespace Phalcon\Mvc\Model\MetaData\Strategy; use Phalcon\DiInterface; use Phalcon\Db\Column; use Phalcon\Mvc\ModelInterface; -use Phalcon\Mvc\Model\MetaData; +use Phalcon\Mvc\Model\MetaData\Enum; use Phalcon\Mvc\Model\MetaData\StrategyInterface; use Phalcon\Mvc\Model\Exception; @@ -391,18 +391,18 @@ class Annotations implements StrategyInterface * Create an array using the MODELS_* constants as indexes */ return [ - MetaData::MODELS_ATTRIBUTES : attributes, - MetaData::MODELS_PRIMARY_KEY : primaryKeys, - MetaData::MODELS_NON_PRIMARY_KEY : nonPrimaryKeys, - MetaData::MODELS_NOT_NULL : notNull, - MetaData::MODELS_DATA_TYPES : fieldTypes, - MetaData::MODELS_DATA_TYPES_NUMERIC : numericTyped, - MetaData::MODELS_IDENTITY_COLUMN : identityField, - MetaData::MODELS_DATA_TYPES_BIND : fieldBindTypes, - MetaData::MODELS_AUTOMATIC_DEFAULT_INSERT : skipOnInsert, - MetaData::MODELS_AUTOMATIC_DEFAULT_UPDATE : skipOnUpdate, - MetaData::MODELS_DEFAULT_VALUES : defaultValues, - MetaData::MODELS_EMPTY_STRING_VALUES : emptyStringValues + Enum::MODELS_ATTRIBUTES : attributes, + Enum::MODELS_PRIMARY_KEY : primaryKeys, + Enum::MODELS_NON_PRIMARY_KEY : nonPrimaryKeys, + Enum::MODELS_NOT_NULL : notNull, + Enum::MODELS_DATA_TYPES : fieldTypes, + Enum::MODELS_DATA_TYPES_NUMERIC : numericTyped, + Enum::MODELS_IDENTITY_COLUMN : identityField, + Enum::MODELS_DATA_TYPES_BIND : fieldBindTypes, + Enum::MODELS_AUTOMATIC_DEFAULT_INSERT : skipOnInsert, + Enum::MODELS_AUTOMATIC_DEFAULT_UPDATE : skipOnUpdate, + Enum::MODELS_DEFAULT_VALUES : defaultValues, + Enum::MODELS_EMPTY_STRING_VALUES : emptyStringValues ]; } } diff --git a/phalcon/Mvc/Model/MetaData/Strategy/Introspection.zep b/phalcon/Mvc/Model/MetaData/Strategy/Introspection.zep index b22c925ba79..337eef14ce2 100644 --- a/phalcon/Mvc/Model/MetaData/Strategy/Introspection.zep +++ b/phalcon/Mvc/Model/MetaData/Strategy/Introspection.zep @@ -15,7 +15,7 @@ use Phalcon\Db\Adapter\AdapterInterface; use Phalcon\Db\Column; use Phalcon\Mvc\ModelInterface; use Phalcon\Mvc\Model\Exception; -use Phalcon\Mvc\Model\MetaData; +use Phalcon\Mvc\Model\MetaData\Enum; use Phalcon\Mvc\Model\MetaData\StrategyInterface; /** @@ -188,18 +188,18 @@ class Introspection implements StrategyInterface * Create an array using the MODELS_* constants as indexes */ return [ - MetaData::MODELS_ATTRIBUTES : attributes, - MetaData::MODELS_PRIMARY_KEY : primaryKeys, - MetaData::MODELS_NON_PRIMARY_KEY : nonPrimaryKeys, - MetaData::MODELS_NOT_NULL : notNull, - MetaData::MODELS_DATA_TYPES : fieldTypes, - MetaData::MODELS_DATA_TYPES_NUMERIC : numericTyped, - MetaData::MODELS_IDENTITY_COLUMN : identityField, - MetaData::MODELS_DATA_TYPES_BIND : fieldBindTypes, - MetaData::MODELS_AUTOMATIC_DEFAULT_INSERT : automaticDefault, - MetaData::MODELS_AUTOMATIC_DEFAULT_UPDATE : automaticDefault, - MetaData::MODELS_DEFAULT_VALUES : defaultValues, - MetaData::MODELS_EMPTY_STRING_VALUES : emptyStringValues + Enum::MODELS_ATTRIBUTES : attributes, + Enum::MODELS_PRIMARY_KEY : primaryKeys, + Enum::MODELS_NON_PRIMARY_KEY : nonPrimaryKeys, + Enum::MODELS_NOT_NULL : notNull, + Enum::MODELS_DATA_TYPES : fieldTypes, + Enum::MODELS_DATA_TYPES_NUMERIC : numericTyped, + Enum::MODELS_IDENTITY_COLUMN : identityField, + Enum::MODELS_DATA_TYPES_BIND : fieldBindTypes, + Enum::MODELS_AUTOMATIC_DEFAULT_INSERT : automaticDefault, + Enum::MODELS_AUTOMATIC_DEFAULT_UPDATE : automaticDefault, + Enum::MODELS_DEFAULT_VALUES : defaultValues, + Enum::MODELS_EMPTY_STRING_VALUES : emptyStringValues ]; } } diff --git a/phalcon/Mvc/Model/MetaData/Stream.zep b/phalcon/Mvc/Model/MetaData/Stream.zep index 92e0c7b5ebd..709dac2d6f8 100644 --- a/phalcon/Mvc/Model/MetaData/Stream.zep +++ b/phalcon/Mvc/Model/MetaData/Stream.zep @@ -10,12 +10,10 @@ namespace Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\MetaData; +use Phalcon\Mvc\Model\MetaData\AbstractMetaData; use Phalcon\Mvc\Model\Exception; /** - * Phalcon\Mvc\Model\MetaData\Stream - * * Stores model meta-data in PHP files. * *```php @@ -26,7 +24,7 @@ use Phalcon\Mvc\Model\Exception; * ); *``` */ -class Stream extends MetaData +class Stream extends AbstractMetaData { protected metaDataDir = "./"; diff --git a/phalcon/Mvc/ModelInterface.zep b/phalcon/Mvc/ModelInterface.zep index 632a0f547f9..6073b2cf772 100644 --- a/phalcon/Mvc/ModelInterface.zep +++ b/phalcon/Mvc/ModelInterface.zep @@ -14,7 +14,7 @@ use Phalcon\DiInterface; use Phalcon\Messages\MessageInterface; use Phalcon\Mvc\Model\CriteriaInterface; use Phalcon\Mvc\Model\ModelInterface; -use Phalcon\Mvc\Model\MetaDataInterface; +use Phalcon\Mvc\Model\MetaData\MetaDataInterface; use Phalcon\Mvc\Model\ResultsetInterface; use Phalcon\Mvc\Model\TransactionInterface; use Phalcon\Mvc\ModelInterface;