diff --git a/core/lib/Thelia/Core/Template/Parser.php b/core/lib/Thelia/Core/Template/Parser.php index 1163171d1..947e3d85a 100644 --- a/core/lib/Thelia/Core/Template/Parser.php +++ b/core/lib/Thelia/Core/Template/Parser.php @@ -152,17 +152,10 @@ class Parser implements ParserInterface $tpex->init($this->container->get("request"), $this->container->get("dispatcher"), $content, THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/"); $tpex->configure( - array( - "foo" => "Test\Loop\Foo", - "doobitch" => "Test\Loop\Doobitch" - ), - array(), - array( - "secure" => "Thelia\Core\Template\BaseParam\Secure" - ), - array( - "equal" => "Test\TestLoop\Equal" - ) + $this->container->get("loop"), + $this->container->get("filter"), + $this->container->get("baseParam"), + $this->container->get("testLoop") ); $this->setContent($tpex->execute()); } diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index c4c2d4c5e..53c8b7352 100644 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -94,7 +94,53 @@ class Thelia extends Kernel */ public function loadConfiguration() { + /** + * TODO : + * - Retrieve all actives plugins + * - load config (create a cache and use this cache + */ + $container = $this->getContainer(); + /** + * Set all listener here. + * Use $dispatcher->addSubscriber or addListener ? + */ + $dispatcher = $container->get("dispatcher"); + + + + + /** + * manage Tpex configuration here + */ + + $config =\Symfony\Component\Config\Util\XmlUtils::loadFile(THELIA_PLUGIN_DIR . "/Test/Config/config.xml"); + var_dump(\Symfony\Component\Config\Util\XmlUtils::convertDomElementToArray($config->documentElement)); + + $this->getLoopConfig(); + + $container->set("loop", array( + "foo" => "Test\Loop\Foo", + "doobitch" => "Test\Loop\Doobitch" + )); + + $container->set("filter", array()); + + $container->set("baseParam", array()); + + $container->set("testLoop", array( + "equal" => "Test\TestLoop\Equal" + )); + + + + } + + protected function getLoopConfig() + { + $modules = \Thelia\Model\ModuleQuery::getActivated(); + + var_dump($modules); } /** diff --git a/core/lib/Thelia/Model/ModuleQuery.php b/core/lib/Thelia/Model/ModuleQuery.php index b17a15d57..40ec784f9 100644 --- a/core/lib/Thelia/Model/ModuleQuery.php +++ b/core/lib/Thelia/Model/ModuleQuery.php @@ -18,4 +18,10 @@ use Thelia\Model\om\BaseModuleQuery; */ class ModuleQuery extends BaseModuleQuery { + public static function getActivated() + { + return self::create() + ->findByActivate(1) + ->find(); + } } diff --git a/core/lib/Thelia/Model/map/AttributeAvDescTableMap.php b/core/lib/Thelia/Model/map/AttributeAvDescTableMap.php deleted file mode 100644 index 30f3a468f..000000000 --- a/core/lib/Thelia/Model/map/AttributeAvDescTableMap.php +++ /dev/null @@ -1,77 +0,0 @@ -setName('attribute_av_desc'); - $this->setPhpName('AttributeAvDesc'); - $this->setClassname('Thelia\\Model\\AttributeAvDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('ATTRIBUTE_AV_ID', 'AttributeAvId', 'INTEGER', 'attribute_av', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('AttributeAv', 'Thelia\\Model\\AttributeAv', RelationMap::MANY_TO_ONE, array('attribute_av_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // AttributeAvDescTableMap diff --git a/core/lib/Thelia/Model/map/AttributeDescTableMap.php b/core/lib/Thelia/Model/map/AttributeDescTableMap.php deleted file mode 100644 index 8447b891e..000000000 --- a/core/lib/Thelia/Model/map/AttributeDescTableMap.php +++ /dev/null @@ -1,77 +0,0 @@ -setName('attribute_desc'); - $this->setPhpName('AttributeDesc'); - $this->setClassname('Thelia\\Model\\AttributeDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addForeignKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', 'attribute', 'ID', true, null, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::MANY_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // AttributeDescTableMap diff --git a/core/lib/Thelia/Model/map/CategoryDescTableMap.php b/core/lib/Thelia/Model/map/CategoryDescTableMap.php deleted file mode 100644 index d05f50f86..000000000 --- a/core/lib/Thelia/Model/map/CategoryDescTableMap.php +++ /dev/null @@ -1,78 +0,0 @@ -setName('category_desc'); - $this->setPhpName('CategoryDesc'); - $this->setClassname('Thelia\\Model\\CategoryDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // CategoryDescTableMap diff --git a/core/lib/Thelia/Model/map/ConfigDescTableMap.php b/core/lib/Thelia/Model/map/ConfigDescTableMap.php deleted file mode 100644 index a7a781c07..000000000 --- a/core/lib/Thelia/Model/map/ConfigDescTableMap.php +++ /dev/null @@ -1,77 +0,0 @@ -setName('config_desc'); - $this->setPhpName('ConfigDesc'); - $this->setClassname('Thelia\\Model\\ConfigDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('CONFIG_ID', 'ConfigId', 'INTEGER', 'config', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Config', 'Thelia\\Model\\Config', RelationMap::MANY_TO_ONE, array('config_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // ConfigDescTableMap diff --git a/core/lib/Thelia/Model/map/ContentDescTableMap.php b/core/lib/Thelia/Model/map/ContentDescTableMap.php deleted file mode 100644 index 066bd4a83..000000000 --- a/core/lib/Thelia/Model/map/ContentDescTableMap.php +++ /dev/null @@ -1,78 +0,0 @@ -setName('content_desc'); - $this->setPhpName('ContentDesc'); - $this->setClassname('Thelia\\Model\\ContentDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // ContentDescTableMap diff --git a/core/lib/Thelia/Model/map/CountryDescTableMap.php b/core/lib/Thelia/Model/map/CountryDescTableMap.php deleted file mode 100644 index d2c6e1d79..000000000 --- a/core/lib/Thelia/Model/map/CountryDescTableMap.php +++ /dev/null @@ -1,77 +0,0 @@ -setName('country_desc'); - $this->setPhpName('CountryDesc'); - $this->setClassname('Thelia\\Model\\CountryDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Country', 'Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // CountryDescTableMap diff --git a/core/lib/Thelia/Model/map/CustomerTitleDescTableMap.php b/core/lib/Thelia/Model/map/CustomerTitleDescTableMap.php deleted file mode 100644 index 947ba2e66..000000000 --- a/core/lib/Thelia/Model/map/CustomerTitleDescTableMap.php +++ /dev/null @@ -1,76 +0,0 @@ -setName('customer_title_desc'); - $this->setPhpName('CustomerTitleDesc'); - $this->setClassname('Thelia\\Model\\CustomerTitleDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', 'customer_title', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('SHORT', 'Short', 'VARCHAR', false, 10, null); - $this->addColumn('LONG', 'Long', 'VARCHAR', false, 45, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CustomerTitle', 'Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('customer_title_id' => 'id', ), 'CASCADE', null); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // CustomerTitleDescTableMap diff --git a/core/lib/Thelia/Model/map/DocumentDescTableMap.php b/core/lib/Thelia/Model/map/DocumentDescTableMap.php deleted file mode 100644 index 3881a6890..000000000 --- a/core/lib/Thelia/Model/map/DocumentDescTableMap.php +++ /dev/null @@ -1,77 +0,0 @@ -setName('document_desc'); - $this->setPhpName('DocumentDesc'); - $this->setClassname('Thelia\\Model\\DocumentDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('DOCUMENT_ID', 'DocumentId', 'INTEGER', 'document', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::MANY_TO_ONE, array('document_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // DocumentDescTableMap diff --git a/core/lib/Thelia/Model/map/FeatureAvDescTableMap.php b/core/lib/Thelia/Model/map/FeatureAvDescTableMap.php deleted file mode 100644 index 66f6a0d3b..000000000 --- a/core/lib/Thelia/Model/map/FeatureAvDescTableMap.php +++ /dev/null @@ -1,77 +0,0 @@ -setName('feature_av_desc'); - $this->setPhpName('FeatureAvDesc'); - $this->setClassname('Thelia\\Model\\FeatureAvDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('FEATURE_AV_ID', 'FeatureAvId', 'INTEGER', 'feature_av', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', true, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', true, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('FeatureAv', 'Thelia\\Model\\FeatureAv', RelationMap::MANY_TO_ONE, array('feature_av_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // FeatureAvDescTableMap diff --git a/core/lib/Thelia/Model/map/FeatureDescTableMap.php b/core/lib/Thelia/Model/map/FeatureDescTableMap.php deleted file mode 100644 index d31966ad4..000000000 --- a/core/lib/Thelia/Model/map/FeatureDescTableMap.php +++ /dev/null @@ -1,77 +0,0 @@ -setName('feature_desc'); - $this->setPhpName('FeatureDesc'); - $this->setClassname('Thelia\\Model\\FeatureDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('FEATURE_ID', 'FeatureId', 'INTEGER', 'feature', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'VARCHAR', false, 45, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::MANY_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // FeatureDescTableMap diff --git a/core/lib/Thelia/Model/map/FolderDescTableMap.php b/core/lib/Thelia/Model/map/FolderDescTableMap.php deleted file mode 100644 index 20061eeef..000000000 --- a/core/lib/Thelia/Model/map/FolderDescTableMap.php +++ /dev/null @@ -1,78 +0,0 @@ -setName('folder_desc'); - $this->setPhpName('FolderDesc'); - $this->setClassname('Thelia\\Model\\FolderDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('FOLDER_ID', 'FolderId', 'INTEGER', 'folder', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // FolderDescTableMap diff --git a/core/lib/Thelia/Model/map/GroupDescTableMap.php b/core/lib/Thelia/Model/map/GroupDescTableMap.php deleted file mode 100644 index d31841fad..000000000 --- a/core/lib/Thelia/Model/map/GroupDescTableMap.php +++ /dev/null @@ -1,77 +0,0 @@ -setName('group_desc'); - $this->setPhpName('GroupDesc'); - $this->setClassname('Thelia\\Model\\GroupDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(false); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('GROUP_ID', 'GroupId', 'INTEGER', 'group', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::MANY_TO_ONE, array('group_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // GroupDescTableMap diff --git a/core/lib/Thelia/Model/map/ImageDescTableMap.php b/core/lib/Thelia/Model/map/ImageDescTableMap.php deleted file mode 100644 index c6fc288a0..000000000 --- a/core/lib/Thelia/Model/map/ImageDescTableMap.php +++ /dev/null @@ -1,76 +0,0 @@ -setName('image_desc'); - $this->setPhpName('ImageDesc'); - $this->setClassname('Thelia\\Model\\ImageDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('IMAGE_ID', 'ImageId', 'INTEGER', 'image', 'ID', false, null, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::MANY_TO_ONE, array('image_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // ImageDescTableMap diff --git a/core/lib/Thelia/Model/map/MessageDescTableMap.php b/core/lib/Thelia/Model/map/MessageDescTableMap.php deleted file mode 100644 index 0cc2bff7c..000000000 --- a/core/lib/Thelia/Model/map/MessageDescTableMap.php +++ /dev/null @@ -1,77 +0,0 @@ -setName('message_desc'); - $this->setPhpName('MessageDesc'); - $this->setClassname('Thelia\\Model\\MessageDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('MESSAGE_ID', 'MessageId', 'INTEGER', 'message', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 45, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('DESCRIPTION_HTML', 'DescriptionHtml', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Message', 'Thelia\\Model\\Message', RelationMap::MANY_TO_ONE, array('message_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // MessageDescTableMap diff --git a/core/lib/Thelia/Model/map/ModuleDescTableMap.php b/core/lib/Thelia/Model/map/ModuleDescTableMap.php deleted file mode 100644 index a59221f29..000000000 --- a/core/lib/Thelia/Model/map/ModuleDescTableMap.php +++ /dev/null @@ -1,78 +0,0 @@ -setName('module_desc'); - $this->setPhpName('ModuleDesc'); - $this->setClassname('Thelia\\Model\\ModuleDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('MODULE_ID', 'ModuleId', 'INTEGER', 'module', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('CURRENCY_ID', 'CurrencyId', 'INTEGER', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Module', 'Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('module_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // ModuleDescTableMap diff --git a/core/lib/Thelia/Model/map/ModuleTableMap.php b/core/lib/Thelia/Model/map/ModuleTableMap.php index 71c70625f..2c5dd3461 100644 --- a/core/lib/Thelia/Model/map/ModuleTableMap.php +++ b/core/lib/Thelia/Model/map/ModuleTableMap.php @@ -44,7 +44,7 @@ class ModuleTableMap extends TableMap // columns $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); $this->addColumn('code', 'Code', 'VARCHAR', true, 55, null); - $this->addColumn(' type', ' type', 'TINYINT', true, null, null); + $this->addColumn('type', 'Type', 'TINYINT', true, null, null); $this->addColumn('activate', 'Activate', 'TINYINT', false, null, null); $this->addColumn('position', 'Position', 'INTEGER', false, null, null); $this->addColumn('created_at', 'CreatedAt', 'TIMESTAMP', false, null, null); diff --git a/core/lib/Thelia/Model/map/OrderStatusDescTableMap.php b/core/lib/Thelia/Model/map/OrderStatusDescTableMap.php deleted file mode 100644 index 4e7cc1be4..000000000 --- a/core/lib/Thelia/Model/map/OrderStatusDescTableMap.php +++ /dev/null @@ -1,77 +0,0 @@ -setName('order_status_desc'); - $this->setPhpName('OrderStatusDesc'); - $this->setClassname('Thelia\\Model\\OrderStatusDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('STATUS_ID', 'StatusId', 'INTEGER', 'order_status', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('OrderStatus', 'Thelia\\Model\\OrderStatus', RelationMap::MANY_TO_ONE, array('status_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // OrderStatusDescTableMap diff --git a/core/lib/Thelia/Model/map/ProductDescTableMap.php b/core/lib/Thelia/Model/map/ProductDescTableMap.php deleted file mode 100644 index 63b9582fd..000000000 --- a/core/lib/Thelia/Model/map/ProductDescTableMap.php +++ /dev/null @@ -1,78 +0,0 @@ -setName('product_desc'); - $this->setPhpName('ProductDesc'); - $this->setClassname('Thelia\\Model\\ProductDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); - $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); - $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // ProductDescTableMap diff --git a/core/lib/Thelia/Model/map/ResourceDescTableMap.php b/core/lib/Thelia/Model/map/ResourceDescTableMap.php deleted file mode 100644 index 86d30305f..000000000 --- a/core/lib/Thelia/Model/map/ResourceDescTableMap.php +++ /dev/null @@ -1,75 +0,0 @@ -setName('resource_desc'); - $this->setPhpName('ResourceDesc'); - $this->setClassname('Thelia\\Model\\ResourceDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('RESOURCE_ID', 'ResourceId', 'INTEGER', 'resource', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Resource', 'Thelia\\Model\\Resource', RelationMap::MANY_TO_ONE, array('resource_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // ResourceDescTableMap diff --git a/core/lib/Thelia/Model/map/TaxDescTableMap.php b/core/lib/Thelia/Model/map/TaxDescTableMap.php deleted file mode 100644 index 9e382f715..000000000 --- a/core/lib/Thelia/Model/map/TaxDescTableMap.php +++ /dev/null @@ -1,76 +0,0 @@ -setName('tax_desc'); - $this->setPhpName('TaxDesc'); - $this->setClassname('Thelia\\Model\\TaxDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('TAX_ID', 'TaxId', 'INTEGER', 'tax', 'ID', true, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Tax', 'Thelia\\Model\\Tax', RelationMap::MANY_TO_ONE, array('tax_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // TaxDescTableMap diff --git a/core/lib/Thelia/Model/map/TaxRuleDescTableMap.php b/core/lib/Thelia/Model/map/TaxRuleDescTableMap.php deleted file mode 100644 index 027ab27c3..000000000 --- a/core/lib/Thelia/Model/map/TaxRuleDescTableMap.php +++ /dev/null @@ -1,76 +0,0 @@ -setName('tax_rule_desc'); - $this->setPhpName('TaxRuleDesc'); - $this->setClassname('Thelia\\Model\\TaxRuleDesc'); - $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('TAX_RULE_ID', 'TaxRuleId', 'INTEGER', 'tax_rule', 'ID', false, null, null); - $this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); - $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('TaxRule', 'Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'CASCADE', 'RESTRICT'); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), - ); - } // getBehaviors() - -} // TaxRuleDescTableMap diff --git a/core/lib/Thelia/Model/om/BaseAttributeAvDesc.php b/core/lib/Thelia/Model/om/BaseAttributeAvDesc.php deleted file mode 100644 index 633e9592d..000000000 --- a/core/lib/Thelia/Model/om/BaseAttributeAvDesc.php +++ /dev/null @@ -1,1345 +0,0 @@ -id; - } - - /** - * Get the [attribute_av_id] column value. - * - * @return int - */ - public function getAttributeAvId() - { - return $this->attribute_av_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return AttributeAvDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = AttributeAvDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [attribute_av_id] column. - * - * @param int $v new value - * @return AttributeAvDesc The current object (for fluent API support) - */ - public function setAttributeAvId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->attribute_av_id !== $v) { - $this->attribute_av_id = $v; - $this->modifiedColumns[] = AttributeAvDescPeer::ATTRIBUTE_AV_ID; - } - - if ($this->aAttributeAv !== null && $this->aAttributeAv->getId() !== $v) { - $this->aAttributeAv = null; - } - - - return $this; - } // setAttributeAvId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return AttributeAvDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = AttributeAvDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return AttributeAvDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = AttributeAvDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return AttributeAvDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = AttributeAvDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return AttributeAvDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = AttributeAvDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return AttributeAvDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = AttributeAvDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return AttributeAvDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = AttributeAvDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->attribute_av_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->updated_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = AttributeAvDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating AttributeAvDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aAttributeAv !== null && $this->attribute_av_id !== $this->aAttributeAv->getId()) { - $this->aAttributeAv = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = AttributeAvDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aAttributeAv = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = AttributeAvDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(AttributeAvDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(AttributeAvDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(AttributeAvDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - AttributeAvDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aAttributeAv !== null) { - if ($this->aAttributeAv->isModified() || $this->aAttributeAv->isNew()) { - $affectedRows += $this->aAttributeAv->save($con); - } - $this->setAttributeAv($this->aAttributeAv); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = AttributeAvDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . AttributeAvDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(AttributeAvDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(AttributeAvDescPeer::ATTRIBUTE_AV_ID)) { - $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_AV_ID`'; - } - if ($this->isColumnModified(AttributeAvDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(AttributeAvDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(AttributeAvDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(AttributeAvDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(AttributeAvDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(AttributeAvDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `attribute_av_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`ATTRIBUTE_AV_ID`': - $stmt->bindValue($identifier, $this->attribute_av_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aAttributeAv !== null) { - if (!$this->aAttributeAv->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aAttributeAv->getValidationFailures()); - } - } - - - if (($retval = AttributeAvDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = AttributeAvDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getAttributeAvId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['AttributeAvDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['AttributeAvDesc'][$this->getPrimaryKey()] = true; - $keys = AttributeAvDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getAttributeAvId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aAttributeAv) { - $result['AttributeAv'] = $this->aAttributeAv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = AttributeAvDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setAttributeAvId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = AttributeAvDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setAttributeAvId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(AttributeAvDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(AttributeAvDescPeer::ID)) $criteria->add(AttributeAvDescPeer::ID, $this->id); - if ($this->isColumnModified(AttributeAvDescPeer::ATTRIBUTE_AV_ID)) $criteria->add(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $this->attribute_av_id); - if ($this->isColumnModified(AttributeAvDescPeer::LANG)) $criteria->add(AttributeAvDescPeer::LANG, $this->lang); - if ($this->isColumnModified(AttributeAvDescPeer::TITLE)) $criteria->add(AttributeAvDescPeer::TITLE, $this->title); - if ($this->isColumnModified(AttributeAvDescPeer::DESCRIPTION)) $criteria->add(AttributeAvDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(AttributeAvDescPeer::CHAPO)) $criteria->add(AttributeAvDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(AttributeAvDescPeer::CREATED_AT)) $criteria->add(AttributeAvDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(AttributeAvDescPeer::UPDATED_AT)) $criteria->add(AttributeAvDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(AttributeAvDescPeer::DATABASE_NAME); - $criteria->add(AttributeAvDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of AttributeAvDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setAttributeAvId($this->getAttributeAvId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return AttributeAvDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return AttributeAvDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new AttributeAvDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a AttributeAv object. - * - * @param AttributeAv $v - * @return AttributeAvDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setAttributeAv(AttributeAv $v = null) - { - if ($v === null) { - $this->setAttributeAvId(NULL); - } else { - $this->setAttributeAvId($v->getId()); - } - - $this->aAttributeAv = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the AttributeAv object, it will not be re-added. - if ($v !== null) { - $v->addAttributeAvDesc($this); - } - - - return $this; - } - - - /** - * Get the associated AttributeAv object - * - * @param PropelPDO $con Optional Connection object. - * @return AttributeAv The associated AttributeAv object. - * @throws PropelException - */ - public function getAttributeAv(PropelPDO $con = null) - { - if ($this->aAttributeAv === null && ($this->attribute_av_id !== null)) { - $this->aAttributeAv = AttributeAvQuery::create()->findPk($this->attribute_av_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aAttributeAv->addAttributeAvDescs($this); - */ - } - - return $this->aAttributeAv; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->attribute_av_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aAttributeAv = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(AttributeAvDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return AttributeAvDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = AttributeAvDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseAttributeAvDescPeer.php b/core/lib/Thelia/Model/om/BaseAttributeAvDescPeer.php deleted file mode 100644 index 35a5dd8e2..000000000 --- a/core/lib/Thelia/Model/om/BaseAttributeAvDescPeer.php +++ /dev/null @@ -1,1037 +0,0 @@ - array ('Id', 'AttributeAvId', 'Lang', 'Title', 'Description', 'Chapo', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'attributeAvId', 'lang', 'title', 'description', 'chapo', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (AttributeAvDescPeer::ID, AttributeAvDescPeer::ATTRIBUTE_AV_ID, AttributeAvDescPeer::LANG, AttributeAvDescPeer::TITLE, AttributeAvDescPeer::DESCRIPTION, AttributeAvDescPeer::CHAPO, AttributeAvDescPeer::CREATED_AT, AttributeAvDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'ATTRIBUTE_AV_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'attribute_av_id', 'lang', 'title', 'description', 'chapo', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. AttributeAvDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'AttributeAvId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'attributeAvId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - BasePeer::TYPE_COLNAME => array (AttributeAvDescPeer::ID => 0, AttributeAvDescPeer::ATTRIBUTE_AV_ID => 1, AttributeAvDescPeer::LANG => 2, AttributeAvDescPeer::TITLE => 3, AttributeAvDescPeer::DESCRIPTION => 4, AttributeAvDescPeer::CHAPO => 5, AttributeAvDescPeer::CREATED_AT => 6, AttributeAvDescPeer::UPDATED_AT => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'ATTRIBUTE_AV_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'attribute_av_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'created_at' => 6, 'updated_at' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = AttributeAvDescPeer::getFieldNames($toType); - $key = isset(AttributeAvDescPeer::$fieldKeys[$fromType][$name]) ? AttributeAvDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AttributeAvDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, AttributeAvDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return AttributeAvDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. AttributeAvDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(AttributeAvDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(AttributeAvDescPeer::ID); - $criteria->addSelectColumn(AttributeAvDescPeer::ATTRIBUTE_AV_ID); - $criteria->addSelectColumn(AttributeAvDescPeer::LANG); - $criteria->addSelectColumn(AttributeAvDescPeer::TITLE); - $criteria->addSelectColumn(AttributeAvDescPeer::DESCRIPTION); - $criteria->addSelectColumn(AttributeAvDescPeer::CHAPO); - $criteria->addSelectColumn(AttributeAvDescPeer::CREATED_AT); - $criteria->addSelectColumn(AttributeAvDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(AttributeAvDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - AttributeAvDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return AttributeAvDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = AttributeAvDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return AttributeAvDescPeer::populateObjects(AttributeAvDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - AttributeAvDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param AttributeAvDesc $obj A AttributeAvDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - AttributeAvDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A AttributeAvDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof AttributeAvDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AttributeAvDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(AttributeAvDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return AttributeAvDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(AttributeAvDescPeer::$instances[$key])) { - return AttributeAvDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - AttributeAvDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to attribute_av_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = AttributeAvDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = AttributeAvDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = AttributeAvDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - AttributeAvDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (AttributeAvDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = AttributeAvDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = AttributeAvDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + AttributeAvDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = AttributeAvDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - AttributeAvDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related AttributeAv table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAttributeAv(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(AttributeAvDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - AttributeAvDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(AttributeAvDescPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of AttributeAvDesc objects pre-filled with their AttributeAv objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of AttributeAvDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAttributeAv(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME); - } - - AttributeAvDescPeer::addSelectColumns($criteria); - $startcol = AttributeAvDescPeer::NUM_HYDRATE_COLUMNS; - AttributeAvPeer::addSelectColumns($criteria); - - $criteria->addJoin(AttributeAvDescPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = AttributeAvDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = AttributeAvDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = AttributeAvDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - AttributeAvDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = AttributeAvPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = AttributeAvPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - AttributeAvPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (AttributeAvDesc) to $obj2 (AttributeAv) - $obj2->addAttributeAvDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(AttributeAvDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - AttributeAvDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(AttributeAvDescPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of AttributeAvDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of AttributeAvDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME); - } - - AttributeAvDescPeer::addSelectColumns($criteria); - $startcol2 = AttributeAvDescPeer::NUM_HYDRATE_COLUMNS; - - AttributeAvPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + AttributeAvPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(AttributeAvDescPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = AttributeAvDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = AttributeAvDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = AttributeAvDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - AttributeAvDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined AttributeAv rows - - $key2 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = AttributeAvPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = AttributeAvPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - AttributeAvPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (AttributeAvDesc) to the collection in $obj2 (AttributeAv) - $obj2->addAttributeAvDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(AttributeAvDescPeer::DATABASE_NAME)->getTable(AttributeAvDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseAttributeAvDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseAttributeAvDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new AttributeAvDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return AttributeAvDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a AttributeAvDesc or Criteria object. - * - * @param mixed $values Criteria or AttributeAvDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from AttributeAvDesc object - } - - if ($criteria->containsKey(AttributeAvDescPeer::ID) && $criteria->keyContainsValue(AttributeAvDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.AttributeAvDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a AttributeAvDesc or Criteria object. - * - * @param mixed $values Criteria or AttributeAvDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(AttributeAvDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(AttributeAvDescPeer::ID); - $value = $criteria->remove(AttributeAvDescPeer::ID); - if ($value) { - $selectCriteria->add(AttributeAvDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(AttributeAvDescPeer::TABLE_NAME); - } - - } else { // $values is AttributeAvDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the attribute_av_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(AttributeAvDescPeer::TABLE_NAME, $con, AttributeAvDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - AttributeAvDescPeer::clearInstancePool(); - AttributeAvDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a AttributeAvDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or AttributeAvDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - AttributeAvDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof AttributeAvDesc) { // it's a model object - // invalidate the cache for this single object - AttributeAvDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(AttributeAvDescPeer::DATABASE_NAME); - $criteria->add(AttributeAvDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - AttributeAvDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - AttributeAvDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given AttributeAvDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param AttributeAvDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(AttributeAvDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(AttributeAvDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(AttributeAvDescPeer::DATABASE_NAME, AttributeAvDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return AttributeAvDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = AttributeAvDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(AttributeAvDescPeer::DATABASE_NAME); - $criteria->add(AttributeAvDescPeer::ID, $pk); - - $v = AttributeAvDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return AttributeAvDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(AttributeAvDescPeer::DATABASE_NAME); - $criteria->add(AttributeAvDescPeer::ID, $pks, Criteria::IN); - $objs = AttributeAvDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseAttributeAvDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseAttributeAvDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseAttributeAvDescQuery.php b/core/lib/Thelia/Model/om/BaseAttributeAvDescQuery.php deleted file mode 100644 index 31faf517d..000000000 --- a/core/lib/Thelia/Model/om/BaseAttributeAvDescQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return AttributeAvDesc|AttributeAvDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = AttributeAvDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return AttributeAvDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `ATTRIBUTE_AV_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_av_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new AttributeAvDesc(); - $obj->hydrate($row); - AttributeAvDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return AttributeAvDesc|AttributeAvDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|AttributeAvDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(AttributeAvDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(AttributeAvDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(AttributeAvDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the attribute_av_id column - * - * Example usage: - * - * $query->filterByAttributeAvId(1234); // WHERE attribute_av_id = 1234 - * $query->filterByAttributeAvId(array(12, 34)); // WHERE attribute_av_id IN (12, 34) - * $query->filterByAttributeAvId(array('min' => 12)); // WHERE attribute_av_id > 12 - * - * - * @see filterByAttributeAv() - * - * @param mixed $attributeAvId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function filterByAttributeAvId($attributeAvId = null, $comparison = null) - { - if (is_array($attributeAvId)) { - $useMinMax = false; - if (isset($attributeAvId['min'])) { - $this->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAvId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($attributeAvId['max'])) { - $this->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAvId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAvId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(AttributeAvDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(AttributeAvDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(AttributeAvDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(AttributeAvDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(AttributeAvDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(AttributeAvDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(AttributeAvDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(AttributeAvDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(AttributeAvDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(AttributeAvDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related AttributeAv object - * - * @param AttributeAv|PropelObjectCollection $attributeAv The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeAvDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByAttributeAv($attributeAv, $comparison = null) - { - if ($attributeAv instanceof AttributeAv) { - return $this - ->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAv->getId(), $comparison); - } elseif ($attributeAv instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAv->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByAttributeAv() only accepts arguments of type AttributeAv or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the AttributeAv relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function joinAttributeAv($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('AttributeAv'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'AttributeAv'); - } - - return $this; - } - - /** - * Use the AttributeAv relation AttributeAv object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\AttributeAvQuery A secondary query class using the current class as primary query - */ - public function useAttributeAvQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinAttributeAv($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'AttributeAv', '\Thelia\Model\AttributeAvQuery'); - } - - /** - * Exclude object from result - * - * @param AttributeAvDesc $attributeAvDesc Object to remove from the list of results - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function prune($attributeAvDesc = null) - { - if ($attributeAvDesc) { - $this->addUsingAlias(AttributeAvDescPeer::ID, $attributeAvDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(AttributeAvDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(AttributeAvDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(AttributeAvDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(AttributeAvDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(AttributeAvDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return AttributeAvDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(AttributeAvDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseAttributeDesc.php b/core/lib/Thelia/Model/om/BaseAttributeDesc.php deleted file mode 100644 index 97fabc7bf..000000000 --- a/core/lib/Thelia/Model/om/BaseAttributeDesc.php +++ /dev/null @@ -1,1345 +0,0 @@ -id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [attribute_id] column value. - * - * @return int - */ - public function getAttributeId() - { - return $this->attribute_id; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return AttributeDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = AttributeDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return AttributeDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = AttributeDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [attribute_id] column. - * - * @param int $v new value - * @return AttributeDesc The current object (for fluent API support) - */ - public function setAttributeId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->attribute_id !== $v) { - $this->attribute_id = $v; - $this->modifiedColumns[] = AttributeDescPeer::ATTRIBUTE_ID; - } - - if ($this->aAttribute !== null && $this->aAttribute->getId() !== $v) { - $this->aAttribute = null; - } - - - return $this; - } // setAttributeId() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return AttributeDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = AttributeDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return AttributeDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = AttributeDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return AttributeDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = AttributeDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return AttributeDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = AttributeDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return AttributeDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = AttributeDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->lang = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->attribute_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->updated_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = AttributeDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating AttributeDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aAttribute !== null && $this->attribute_id !== $this->aAttribute->getId()) { - $this->aAttribute = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = AttributeDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aAttribute = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = AttributeDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(AttributeDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(AttributeDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(AttributeDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - AttributeDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aAttribute !== null) { - if ($this->aAttribute->isModified() || $this->aAttribute->isNew()) { - $affectedRows += $this->aAttribute->save($con); - } - $this->setAttribute($this->aAttribute); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = AttributeDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . AttributeDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(AttributeDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(AttributeDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(AttributeDescPeer::ATTRIBUTE_ID)) { - $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_ID`'; - } - if ($this->isColumnModified(AttributeDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(AttributeDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(AttributeDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(AttributeDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(AttributeDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `attribute_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`ATTRIBUTE_ID`': - $stmt->bindValue($identifier, $this->attribute_id, PDO::PARAM_INT); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aAttribute !== null) { - if (!$this->aAttribute->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aAttribute->getValidationFailures()); - } - } - - - if (($retval = AttributeDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = AttributeDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getLang(); - break; - case 2: - return $this->getAttributeId(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['AttributeDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['AttributeDesc'][$this->getPrimaryKey()] = true; - $keys = AttributeDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getLang(), - $keys[2] => $this->getAttributeId(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aAttribute) { - $result['Attribute'] = $this->aAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = AttributeDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setLang($value); - break; - case 2: - $this->setAttributeId($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = AttributeDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setLang($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setAttributeId($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(AttributeDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(AttributeDescPeer::ID)) $criteria->add(AttributeDescPeer::ID, $this->id); - if ($this->isColumnModified(AttributeDescPeer::LANG)) $criteria->add(AttributeDescPeer::LANG, $this->lang); - if ($this->isColumnModified(AttributeDescPeer::ATTRIBUTE_ID)) $criteria->add(AttributeDescPeer::ATTRIBUTE_ID, $this->attribute_id); - if ($this->isColumnModified(AttributeDescPeer::TITLE)) $criteria->add(AttributeDescPeer::TITLE, $this->title); - if ($this->isColumnModified(AttributeDescPeer::DESCRIPTION)) $criteria->add(AttributeDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(AttributeDescPeer::CHAPO)) $criteria->add(AttributeDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(AttributeDescPeer::CREATED_AT)) $criteria->add(AttributeDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(AttributeDescPeer::UPDATED_AT)) $criteria->add(AttributeDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(AttributeDescPeer::DATABASE_NAME); - $criteria->add(AttributeDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of AttributeDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setLang($this->getLang()); - $copyObj->setAttributeId($this->getAttributeId()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return AttributeDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return AttributeDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new AttributeDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Attribute object. - * - * @param Attribute $v - * @return AttributeDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setAttribute(Attribute $v = null) - { - if ($v === null) { - $this->setAttributeId(NULL); - } else { - $this->setAttributeId($v->getId()); - } - - $this->aAttribute = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Attribute object, it will not be re-added. - if ($v !== null) { - $v->addAttributeDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Attribute object - * - * @param PropelPDO $con Optional Connection object. - * @return Attribute The associated Attribute object. - * @throws PropelException - */ - public function getAttribute(PropelPDO $con = null) - { - if ($this->aAttribute === null && ($this->attribute_id !== null)) { - $this->aAttribute = AttributeQuery::create()->findPk($this->attribute_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aAttribute->addAttributeDescs($this); - */ - } - - return $this->aAttribute; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->lang = null; - $this->attribute_id = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aAttribute = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(AttributeDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return AttributeDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = AttributeDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseAttributeDescPeer.php b/core/lib/Thelia/Model/om/BaseAttributeDescPeer.php deleted file mode 100644 index 4dd4dd57d..000000000 --- a/core/lib/Thelia/Model/om/BaseAttributeDescPeer.php +++ /dev/null @@ -1,1037 +0,0 @@ - array ('Id', 'Lang', 'AttributeId', 'Title', 'Description', 'Chapo', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'lang', 'attributeId', 'title', 'description', 'chapo', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (AttributeDescPeer::ID, AttributeDescPeer::LANG, AttributeDescPeer::ATTRIBUTE_ID, AttributeDescPeer::TITLE, AttributeDescPeer::DESCRIPTION, AttributeDescPeer::CHAPO, AttributeDescPeer::CREATED_AT, AttributeDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LANG', 'ATTRIBUTE_ID', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'lang', 'attribute_id', 'title', 'description', 'chapo', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. AttributeDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Lang' => 1, 'AttributeId' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'lang' => 1, 'attributeId' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - BasePeer::TYPE_COLNAME => array (AttributeDescPeer::ID => 0, AttributeDescPeer::LANG => 1, AttributeDescPeer::ATTRIBUTE_ID => 2, AttributeDescPeer::TITLE => 3, AttributeDescPeer::DESCRIPTION => 4, AttributeDescPeer::CHAPO => 5, AttributeDescPeer::CREATED_AT => 6, AttributeDescPeer::UPDATED_AT => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LANG' => 1, 'ATTRIBUTE_ID' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'lang' => 1, 'attribute_id' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'created_at' => 6, 'updated_at' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = AttributeDescPeer::getFieldNames($toType); - $key = isset(AttributeDescPeer::$fieldKeys[$fromType][$name]) ? AttributeDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AttributeDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, AttributeDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return AttributeDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. AttributeDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(AttributeDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(AttributeDescPeer::ID); - $criteria->addSelectColumn(AttributeDescPeer::LANG); - $criteria->addSelectColumn(AttributeDescPeer::ATTRIBUTE_ID); - $criteria->addSelectColumn(AttributeDescPeer::TITLE); - $criteria->addSelectColumn(AttributeDescPeer::DESCRIPTION); - $criteria->addSelectColumn(AttributeDescPeer::CHAPO); - $criteria->addSelectColumn(AttributeDescPeer::CREATED_AT); - $criteria->addSelectColumn(AttributeDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.ATTRIBUTE_ID'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(AttributeDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - AttributeDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(AttributeDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return AttributeDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = AttributeDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return AttributeDescPeer::populateObjects(AttributeDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - AttributeDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(AttributeDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param AttributeDesc $obj A AttributeDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - AttributeDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A AttributeDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof AttributeDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AttributeDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(AttributeDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return AttributeDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(AttributeDescPeer::$instances[$key])) { - return AttributeDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - AttributeDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to attribute_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = AttributeDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = AttributeDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = AttributeDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - AttributeDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (AttributeDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = AttributeDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = AttributeDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + AttributeDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = AttributeDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - AttributeDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Attribute table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAttribute(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(AttributeDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - AttributeDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(AttributeDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(AttributeDescPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of AttributeDesc objects pre-filled with their Attribute objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of AttributeDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAttribute(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(AttributeDescPeer::DATABASE_NAME); - } - - AttributeDescPeer::addSelectColumns($criteria); - $startcol = AttributeDescPeer::NUM_HYDRATE_COLUMNS; - AttributePeer::addSelectColumns($criteria); - - $criteria->addJoin(AttributeDescPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = AttributeDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = AttributeDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = AttributeDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - AttributeDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = AttributePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = AttributePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - AttributePeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (AttributeDesc) to $obj2 (Attribute) - $obj2->addAttributeDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(AttributeDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - AttributeDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(AttributeDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(AttributeDescPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of AttributeDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of AttributeDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(AttributeDescPeer::DATABASE_NAME); - } - - AttributeDescPeer::addSelectColumns($criteria); - $startcol2 = AttributeDescPeer::NUM_HYDRATE_COLUMNS; - - AttributePeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + AttributePeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(AttributeDescPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = AttributeDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = AttributeDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = AttributeDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - AttributeDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Attribute rows - - $key2 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = AttributePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = AttributePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - AttributePeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (AttributeDesc) to the collection in $obj2 (Attribute) - $obj2->addAttributeDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(AttributeDescPeer::DATABASE_NAME)->getTable(AttributeDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseAttributeDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseAttributeDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new AttributeDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return AttributeDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a AttributeDesc or Criteria object. - * - * @param mixed $values Criteria or AttributeDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from AttributeDesc object - } - - if ($criteria->containsKey(AttributeDescPeer::ID) && $criteria->keyContainsValue(AttributeDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.AttributeDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(AttributeDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a AttributeDesc or Criteria object. - * - * @param mixed $values Criteria or AttributeDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(AttributeDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(AttributeDescPeer::ID); - $value = $criteria->remove(AttributeDescPeer::ID); - if ($value) { - $selectCriteria->add(AttributeDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(AttributeDescPeer::TABLE_NAME); - } - - } else { // $values is AttributeDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(AttributeDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the attribute_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(AttributeDescPeer::TABLE_NAME, $con, AttributeDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - AttributeDescPeer::clearInstancePool(); - AttributeDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a AttributeDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or AttributeDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - AttributeDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof AttributeDesc) { // it's a model object - // invalidate the cache for this single object - AttributeDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(AttributeDescPeer::DATABASE_NAME); - $criteria->add(AttributeDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - AttributeDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(AttributeDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - AttributeDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given AttributeDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param AttributeDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(AttributeDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(AttributeDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(AttributeDescPeer::DATABASE_NAME, AttributeDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return AttributeDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = AttributeDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(AttributeDescPeer::DATABASE_NAME); - $criteria->add(AttributeDescPeer::ID, $pk); - - $v = AttributeDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return AttributeDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(AttributeDescPeer::DATABASE_NAME); - $criteria->add(AttributeDescPeer::ID, $pks, Criteria::IN); - $objs = AttributeDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseAttributeDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseAttributeDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseAttributeDescQuery.php b/core/lib/Thelia/Model/om/BaseAttributeDescQuery.php deleted file mode 100644 index 3ce899271..000000000 --- a/core/lib/Thelia/Model/om/BaseAttributeDescQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return AttributeDesc|AttributeDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = AttributeDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return AttributeDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `LANG`, `ATTRIBUTE_ID`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new AttributeDesc(); - $obj->hydrate($row); - AttributeDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return AttributeDesc|AttributeDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|AttributeDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(AttributeDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(AttributeDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(AttributeDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(AttributeDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the attribute_id column - * - * Example usage: - * - * $query->filterByAttributeId(1234); // WHERE attribute_id = 1234 - * $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34) - * $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12 - * - * - * @see filterByAttribute() - * - * @param mixed $attributeId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function filterByAttributeId($attributeId = null, $comparison = null) - { - if (is_array($attributeId)) { - $useMinMax = false; - if (isset($attributeId['min'])) { - $this->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attributeId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($attributeId['max'])) { - $this->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attributeId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attributeId, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(AttributeDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(AttributeDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(AttributeDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(AttributeDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(AttributeDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(AttributeDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(AttributeDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(AttributeDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(AttributeDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Attribute object - * - * @param Attribute|PropelObjectCollection $attribute The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return AttributeDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByAttribute($attribute, $comparison = null) - { - if ($attribute instanceof Attribute) { - return $this - ->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison); - } elseif ($attribute instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByAttribute() only accepts arguments of type Attribute or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Attribute relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Attribute'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Attribute'); - } - - return $this; - } - - /** - * Use the Attribute relation Attribute object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\AttributeQuery A secondary query class using the current class as primary query - */ - public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinAttribute($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery'); - } - - /** - * Exclude object from result - * - * @param AttributeDesc $attributeDesc Object to remove from the list of results - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function prune($attributeDesc = null) - { - if ($attributeDesc) { - $this->addUsingAlias(AttributeDescPeer::ID, $attributeDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(AttributeDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(AttributeDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(AttributeDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(AttributeDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(AttributeDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return AttributeDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(AttributeDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseCategoryDesc.php b/core/lib/Thelia/Model/om/BaseCategoryDesc.php deleted file mode 100644 index ee2d8a71f..000000000 --- a/core/lib/Thelia/Model/om/BaseCategoryDesc.php +++ /dev/null @@ -1,1400 +0,0 @@ -id; - } - - /** - * Get the [category_id] column value. - * - * @return int - */ - public function getCategoryId() - { - return $this->category_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [postscriptum] column value. - * - * @return string - */ - public function getPostscriptum() - { - return $this->postscriptum; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CategoryDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CategoryDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [category_id] column. - * - * @param int $v new value - * @return CategoryDesc The current object (for fluent API support) - */ - public function setCategoryId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->category_id !== $v) { - $this->category_id = $v; - $this->modifiedColumns[] = CategoryDescPeer::CATEGORY_ID; - } - - if ($this->aCategory !== null && $this->aCategory->getId() !== $v) { - $this->aCategory = null; - } - - - return $this; - } // setCategoryId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return CategoryDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = CategoryDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return CategoryDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = CategoryDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return CategoryDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = CategoryDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return CategoryDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = CategoryDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Set the value of [postscriptum] column. - * - * @param string $v new value - * @return CategoryDesc The current object (for fluent API support) - */ - public function setPostscriptum($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->postscriptum !== $v) { - $this->postscriptum = $v; - $this->modifiedColumns[] = CategoryDescPeer::POSTSCRIPTUM; - } - - - return $this; - } // setPostscriptum() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return CategoryDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = CategoryDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return CategoryDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = CategoryDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->category_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->postscriptum = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->created_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->updated_at = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 9; // 9 = CategoryDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating CategoryDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aCategory !== null && $this->category_id !== $this->aCategory->getId()) { - $this->aCategory = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CategoryDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aCategory = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = CategoryDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(CategoryDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(CategoryDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(CategoryDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CategoryDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCategory !== null) { - if ($this->aCategory->isModified() || $this->aCategory->isNew()) { - $affectedRows += $this->aCategory->save($con); - } - $this->setCategory($this->aCategory); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = CategoryDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . CategoryDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(CategoryDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(CategoryDescPeer::CATEGORY_ID)) { - $modifiedColumns[':p' . $index++] = '`CATEGORY_ID`'; - } - if ($this->isColumnModified(CategoryDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(CategoryDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(CategoryDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(CategoryDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(CategoryDescPeer::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; - } - if ($this->isColumnModified(CategoryDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(CategoryDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `category_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`CATEGORY_ID`': - $stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`POSTSCRIPTUM`': - $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCategory !== null) { - if (!$this->aCategory->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCategory->getValidationFailures()); - } - } - - - if (($retval = CategoryDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CategoryDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getCategoryId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getPostscriptum(); - break; - case 7: - return $this->getCreatedAt(); - break; - case 8: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['CategoryDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['CategoryDesc'][$this->getPrimaryKey()] = true; - $keys = CategoryDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getCategoryId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getPostscriptum(), - $keys[7] => $this->getCreatedAt(), - $keys[8] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aCategory) { - $result['Category'] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CategoryDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setCategoryId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setPostscriptum($value); - break; - case 7: - $this->setCreatedAt($value); - break; - case 8: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CategoryDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setCategoryId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setPostscriptum($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CategoryDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(CategoryDescPeer::ID)) $criteria->add(CategoryDescPeer::ID, $this->id); - if ($this->isColumnModified(CategoryDescPeer::CATEGORY_ID)) $criteria->add(CategoryDescPeer::CATEGORY_ID, $this->category_id); - if ($this->isColumnModified(CategoryDescPeer::LANG)) $criteria->add(CategoryDescPeer::LANG, $this->lang); - if ($this->isColumnModified(CategoryDescPeer::TITLE)) $criteria->add(CategoryDescPeer::TITLE, $this->title); - if ($this->isColumnModified(CategoryDescPeer::DESCRIPTION)) $criteria->add(CategoryDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(CategoryDescPeer::CHAPO)) $criteria->add(CategoryDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(CategoryDescPeer::POSTSCRIPTUM)) $criteria->add(CategoryDescPeer::POSTSCRIPTUM, $this->postscriptum); - if ($this->isColumnModified(CategoryDescPeer::CREATED_AT)) $criteria->add(CategoryDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(CategoryDescPeer::UPDATED_AT)) $criteria->add(CategoryDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CategoryDescPeer::DATABASE_NAME); - $criteria->add(CategoryDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CategoryDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setCategoryId($this->getCategoryId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setPostscriptum($this->getPostscriptum()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CategoryDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CategoryDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CategoryDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Category object. - * - * @param Category $v - * @return CategoryDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setCategory(Category $v = null) - { - if ($v === null) { - $this->setCategoryId(NULL); - } else { - $this->setCategoryId($v->getId()); - } - - $this->aCategory = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Category object, it will not be re-added. - if ($v !== null) { - $v->addCategoryDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Category object - * - * @param PropelPDO $con Optional Connection object. - * @return Category The associated Category object. - * @throws PropelException - */ - public function getCategory(PropelPDO $con = null) - { - if ($this->aCategory === null && ($this->category_id !== null)) { - $this->aCategory = CategoryQuery::create()->findPk($this->category_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCategory->addCategoryDescs($this); - */ - } - - return $this->aCategory; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->category_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->postscriptum = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aCategory = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(CategoryDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return CategoryDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = CategoryDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseCategoryDescPeer.php b/core/lib/Thelia/Model/om/BaseCategoryDescPeer.php deleted file mode 100644 index eeb25a350..000000000 --- a/core/lib/Thelia/Model/om/BaseCategoryDescPeer.php +++ /dev/null @@ -1,1042 +0,0 @@ - array ('Id', 'CategoryId', 'Lang', 'Title', 'Description', 'Chapo', 'Postscriptum', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'categoryId', 'lang', 'title', 'description', 'chapo', 'postscriptum', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (CategoryDescPeer::ID, CategoryDescPeer::CATEGORY_ID, CategoryDescPeer::LANG, CategoryDescPeer::TITLE, CategoryDescPeer::DESCRIPTION, CategoryDescPeer::CHAPO, CategoryDescPeer::POSTSCRIPTUM, CategoryDescPeer::CREATED_AT, CategoryDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CATEGORY_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'category_id', 'lang', 'title', 'description', 'chapo', 'postscriptum', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. CategoryDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'CategoryId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'Postscriptum' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'categoryId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'postscriptum' => 6, 'createdAt' => 7, 'updatedAt' => 8, ), - BasePeer::TYPE_COLNAME => array (CategoryDescPeer::ID => 0, CategoryDescPeer::CATEGORY_ID => 1, CategoryDescPeer::LANG => 2, CategoryDescPeer::TITLE => 3, CategoryDescPeer::DESCRIPTION => 4, CategoryDescPeer::CHAPO => 5, CategoryDescPeer::POSTSCRIPTUM => 6, CategoryDescPeer::CREATED_AT => 7, CategoryDescPeer::UPDATED_AT => 8, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CATEGORY_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'POSTSCRIPTUM' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'category_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'postscriptum' => 6, 'created_at' => 7, 'updated_at' => 8, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = CategoryDescPeer::getFieldNames($toType); - $key = isset(CategoryDescPeer::$fieldKeys[$fromType][$name]) ? CategoryDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CategoryDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, CategoryDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return CategoryDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CategoryDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CategoryDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CategoryDescPeer::ID); - $criteria->addSelectColumn(CategoryDescPeer::CATEGORY_ID); - $criteria->addSelectColumn(CategoryDescPeer::LANG); - $criteria->addSelectColumn(CategoryDescPeer::TITLE); - $criteria->addSelectColumn(CategoryDescPeer::DESCRIPTION); - $criteria->addSelectColumn(CategoryDescPeer::CHAPO); - $criteria->addSelectColumn(CategoryDescPeer::POSTSCRIPTUM); - $criteria->addSelectColumn(CategoryDescPeer::CREATED_AT); - $criteria->addSelectColumn(CategoryDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.CATEGORY_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.POSTSCRIPTUM'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CategoryDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CategoryDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(CategoryDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CategoryDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CategoryDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CategoryDescPeer::populateObjects(CategoryDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CategoryDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(CategoryDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CategoryDesc $obj A CategoryDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - CategoryDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CategoryDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CategoryDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CategoryDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(CategoryDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CategoryDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(CategoryDescPeer::$instances[$key])) { - return CategoryDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - CategoryDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to category_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CategoryDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CategoryDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CategoryDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CategoryDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CategoryDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CategoryDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CategoryDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CategoryDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = CategoryDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CategoryDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Category table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCategory(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CategoryDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CategoryDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(CategoryDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CategoryDescPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of CategoryDesc objects pre-filled with their Category objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CategoryDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCategory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(CategoryDescPeer::DATABASE_NAME); - } - - CategoryDescPeer::addSelectColumns($criteria); - $startcol = CategoryDescPeer::NUM_HYDRATE_COLUMNS; - CategoryPeer::addSelectColumns($criteria); - - $criteria->addJoin(CategoryDescPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CategoryDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CategoryDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CategoryDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CategoryDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CategoryPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CategoryPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CategoryPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CategoryDesc) to $obj2 (Category) - $obj2->addCategoryDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CategoryDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CategoryDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(CategoryDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CategoryDescPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of CategoryDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CategoryDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(CategoryDescPeer::DATABASE_NAME); - } - - CategoryDescPeer::addSelectColumns($criteria); - $startcol2 = CategoryDescPeer::NUM_HYDRATE_COLUMNS; - - CategoryPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(CategoryDescPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CategoryDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CategoryDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CategoryDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CategoryDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Category rows - - $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CategoryPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CategoryPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CategoryPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CategoryDesc) to the collection in $obj2 (Category) - $obj2->addCategoryDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(CategoryDescPeer::DATABASE_NAME)->getTable(CategoryDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCategoryDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCategoryDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new CategoryDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return CategoryDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a CategoryDesc or Criteria object. - * - * @param mixed $values Criteria or CategoryDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CategoryDesc object - } - - if ($criteria->containsKey(CategoryDescPeer::ID) && $criteria->keyContainsValue(CategoryDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CategoryDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(CategoryDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a CategoryDesc or Criteria object. - * - * @param mixed $values Criteria or CategoryDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(CategoryDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CategoryDescPeer::ID); - $value = $criteria->remove(CategoryDescPeer::ID); - if ($value) { - $selectCriteria->add(CategoryDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CategoryDescPeer::TABLE_NAME); - } - - } else { // $values is CategoryDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(CategoryDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the category_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CategoryDescPeer::TABLE_NAME, $con, CategoryDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CategoryDescPeer::clearInstancePool(); - CategoryDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a CategoryDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CategoryDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CategoryDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CategoryDesc) { // it's a model object - // invalidate the cache for this single object - CategoryDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(CategoryDescPeer::DATABASE_NAME); - $criteria->add(CategoryDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CategoryDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(CategoryDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CategoryDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CategoryDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CategoryDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CategoryDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CategoryDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CategoryDescPeer::DATABASE_NAME, CategoryDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CategoryDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CategoryDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CategoryDescPeer::DATABASE_NAME); - $criteria->add(CategoryDescPeer::ID, $pk); - - $v = CategoryDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return CategoryDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CategoryDescPeer::DATABASE_NAME); - $criteria->add(CategoryDescPeer::ID, $pks, Criteria::IN); - $objs = CategoryDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseCategoryDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCategoryDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseCategoryDescQuery.php b/core/lib/Thelia/Model/om/BaseCategoryDescQuery.php deleted file mode 100644 index a2699bfb2..000000000 --- a/core/lib/Thelia/Model/om/BaseCategoryDescQuery.php +++ /dev/null @@ -1,711 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CategoryDesc|CategoryDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = CategoryDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return CategoryDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `CATEGORY_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `CREATED_AT`, `UPDATED_AT` FROM `category_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new CategoryDesc(); - $obj->hydrate($row); - CategoryDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return CategoryDesc|CategoryDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|CategoryDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(CategoryDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(CategoryDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(CategoryDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the category_id column - * - * Example usage: - * - * $query->filterByCategoryId(1234); // WHERE category_id = 1234 - * $query->filterByCategoryId(array(12, 34)); // WHERE category_id IN (12, 34) - * $query->filterByCategoryId(array('min' => 12)); // WHERE category_id > 12 - * - * - * @see filterByCategory() - * - * @param mixed $categoryId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterByCategoryId($categoryId = null, $comparison = null) - { - if (is_array($categoryId)) { - $useMinMax = false; - if (isset($categoryId['min'])) { - $this->addUsingAlias(CategoryDescPeer::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($categoryId['max'])) { - $this->addUsingAlias(CategoryDescPeer::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CategoryDescPeer::CATEGORY_ID, $categoryId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CategoryDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CategoryDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CategoryDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CategoryDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the postscriptum column - * - * Example usage: - * - * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue' - * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%' - * - * - * @param string $postscriptum The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterByPostscriptum($postscriptum = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($postscriptum)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $postscriptum)) { - $postscriptum = str_replace('*', '%', $postscriptum); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CategoryDescPeer::POSTSCRIPTUM, $postscriptum, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(CategoryDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(CategoryDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CategoryDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(CategoryDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(CategoryDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CategoryDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Category object - * - * @param Category|PropelObjectCollection $category The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CategoryDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByCategory($category, $comparison = null) - { - if ($category instanceof Category) { - return $this - ->addUsingAlias(CategoryDescPeer::CATEGORY_ID, $category->getId(), $comparison); - } elseif ($category instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(CategoryDescPeer::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByCategory() only accepts arguments of type Category or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Category relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Category'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Category'); - } - - return $this; - } - - /** - * Use the Category relation Category object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query - */ - public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinCategory($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery'); - } - - /** - * Exclude object from result - * - * @param CategoryDesc $categoryDesc Object to remove from the list of results - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function prune($categoryDesc = null) - { - if ($categoryDesc) { - $this->addUsingAlias(CategoryDescPeer::ID, $categoryDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(CategoryDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(CategoryDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(CategoryDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(CategoryDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(CategoryDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return CategoryDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(CategoryDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseConfigDesc.php b/core/lib/Thelia/Model/om/BaseConfigDesc.php deleted file mode 100644 index 77d2ce177..000000000 --- a/core/lib/Thelia/Model/om/BaseConfigDesc.php +++ /dev/null @@ -1,1345 +0,0 @@ -id; - } - - /** - * Get the [config_id] column value. - * - * @return int - */ - public function getConfigId() - { - return $this->config_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return ConfigDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = ConfigDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [config_id] column. - * - * @param int $v new value - * @return ConfigDesc The current object (for fluent API support) - */ - public function setConfigId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->config_id !== $v) { - $this->config_id = $v; - $this->modifiedColumns[] = ConfigDescPeer::CONFIG_ID; - } - - if ($this->aConfig !== null && $this->aConfig->getId() !== $v) { - $this->aConfig = null; - } - - - return $this; - } // setConfigId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return ConfigDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = ConfigDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return ConfigDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = ConfigDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return ConfigDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = ConfigDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return ConfigDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = ConfigDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ConfigDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = ConfigDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ConfigDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = ConfigDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->config_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->updated_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = ConfigDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating ConfigDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aConfig !== null && $this->config_id !== $this->aConfig->getId()) { - $this->aConfig = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = ConfigDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aConfig = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = ConfigDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(ConfigDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(ConfigDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ConfigDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - ConfigDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aConfig !== null) { - if ($this->aConfig->isModified() || $this->aConfig->isNew()) { - $affectedRows += $this->aConfig->save($con); - } - $this->setConfig($this->aConfig); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = ConfigDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ConfigDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ConfigDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(ConfigDescPeer::CONFIG_ID)) { - $modifiedColumns[':p' . $index++] = '`CONFIG_ID`'; - } - if ($this->isColumnModified(ConfigDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(ConfigDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(ConfigDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(ConfigDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(ConfigDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(ConfigDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `config_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`CONFIG_ID`': - $stmt->bindValue($identifier, $this->config_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aConfig !== null) { - if (!$this->aConfig->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aConfig->getValidationFailures()); - } - } - - - if (($retval = ConfigDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ConfigDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getConfigId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['ConfigDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['ConfigDesc'][$this->getPrimaryKey()] = true; - $keys = ConfigDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getConfigId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aConfig) { - $result['Config'] = $this->aConfig->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ConfigDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setConfigId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = ConfigDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setConfigId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(ConfigDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(ConfigDescPeer::ID)) $criteria->add(ConfigDescPeer::ID, $this->id); - if ($this->isColumnModified(ConfigDescPeer::CONFIG_ID)) $criteria->add(ConfigDescPeer::CONFIG_ID, $this->config_id); - if ($this->isColumnModified(ConfigDescPeer::LANG)) $criteria->add(ConfigDescPeer::LANG, $this->lang); - if ($this->isColumnModified(ConfigDescPeer::TITLE)) $criteria->add(ConfigDescPeer::TITLE, $this->title); - if ($this->isColumnModified(ConfigDescPeer::DESCRIPTION)) $criteria->add(ConfigDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(ConfigDescPeer::CHAPO)) $criteria->add(ConfigDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(ConfigDescPeer::CREATED_AT)) $criteria->add(ConfigDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ConfigDescPeer::UPDATED_AT)) $criteria->add(ConfigDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(ConfigDescPeer::DATABASE_NAME); - $criteria->add(ConfigDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of ConfigDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setConfigId($this->getConfigId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return ConfigDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ConfigDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new ConfigDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Config object. - * - * @param Config $v - * @return ConfigDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setConfig(Config $v = null) - { - if ($v === null) { - $this->setConfigId(NULL); - } else { - $this->setConfigId($v->getId()); - } - - $this->aConfig = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Config object, it will not be re-added. - if ($v !== null) { - $v->addConfigDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Config object - * - * @param PropelPDO $con Optional Connection object. - * @return Config The associated Config object. - * @throws PropelException - */ - public function getConfig(PropelPDO $con = null) - { - if ($this->aConfig === null && ($this->config_id !== null)) { - $this->aConfig = ConfigQuery::create()->findPk($this->config_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aConfig->addConfigDescs($this); - */ - } - - return $this->aConfig; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->config_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aConfig = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(ConfigDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return ConfigDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = ConfigDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseConfigDescPeer.php b/core/lib/Thelia/Model/om/BaseConfigDescPeer.php deleted file mode 100644 index 87950542f..000000000 --- a/core/lib/Thelia/Model/om/BaseConfigDescPeer.php +++ /dev/null @@ -1,1037 +0,0 @@ - array ('Id', 'ConfigId', 'Lang', 'Title', 'Description', 'Chapo', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'configId', 'lang', 'title', 'description', 'chapo', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (ConfigDescPeer::ID, ConfigDescPeer::CONFIG_ID, ConfigDescPeer::LANG, ConfigDescPeer::TITLE, ConfigDescPeer::DESCRIPTION, ConfigDescPeer::CHAPO, ConfigDescPeer::CREATED_AT, ConfigDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CONFIG_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'config_id', 'lang', 'title', 'description', 'chapo', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. ConfigDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'ConfigId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'configId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - BasePeer::TYPE_COLNAME => array (ConfigDescPeer::ID => 0, ConfigDescPeer::CONFIG_ID => 1, ConfigDescPeer::LANG => 2, ConfigDescPeer::TITLE => 3, ConfigDescPeer::DESCRIPTION => 4, ConfigDescPeer::CHAPO => 5, ConfigDescPeer::CREATED_AT => 6, ConfigDescPeer::UPDATED_AT => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CONFIG_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'config_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'created_at' => 6, 'updated_at' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = ConfigDescPeer::getFieldNames($toType); - $key = isset(ConfigDescPeer::$fieldKeys[$fromType][$name]) ? ConfigDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ConfigDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, ConfigDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return ConfigDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ConfigDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(ConfigDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(ConfigDescPeer::ID); - $criteria->addSelectColumn(ConfigDescPeer::CONFIG_ID); - $criteria->addSelectColumn(ConfigDescPeer::LANG); - $criteria->addSelectColumn(ConfigDescPeer::TITLE); - $criteria->addSelectColumn(ConfigDescPeer::DESCRIPTION); - $criteria->addSelectColumn(ConfigDescPeer::CHAPO); - $criteria->addSelectColumn(ConfigDescPeer::CREATED_AT); - $criteria->addSelectColumn(ConfigDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.CONFIG_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ConfigDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ConfigDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(ConfigDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return ConfigDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = ConfigDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return ConfigDescPeer::populateObjects(ConfigDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - ConfigDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(ConfigDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param ConfigDesc $obj A ConfigDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - ConfigDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A ConfigDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof ConfigDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ConfigDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(ConfigDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return ConfigDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(ConfigDescPeer::$instances[$key])) { - return ConfigDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - ConfigDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to config_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = ConfigDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = ConfigDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = ConfigDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - ConfigDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (ConfigDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = ConfigDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = ConfigDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + ConfigDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = ConfigDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - ConfigDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Config table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinConfig(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ConfigDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ConfigDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ConfigDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ConfigDescPeer::CONFIG_ID, ConfigPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of ConfigDesc objects pre-filled with their Config objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ConfigDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinConfig(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ConfigDescPeer::DATABASE_NAME); - } - - ConfigDescPeer::addSelectColumns($criteria); - $startcol = ConfigDescPeer::NUM_HYDRATE_COLUMNS; - ConfigPeer::addSelectColumns($criteria); - - $criteria->addJoin(ConfigDescPeer::CONFIG_ID, ConfigPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ConfigDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ConfigDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = ConfigDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ConfigDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = ConfigPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = ConfigPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ConfigPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - ConfigPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (ConfigDesc) to $obj2 (Config) - $obj2->addConfigDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ConfigDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ConfigDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ConfigDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ConfigDescPeer::CONFIG_ID, ConfigPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of ConfigDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ConfigDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ConfigDescPeer::DATABASE_NAME); - } - - ConfigDescPeer::addSelectColumns($criteria); - $startcol2 = ConfigDescPeer::NUM_HYDRATE_COLUMNS; - - ConfigPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + ConfigPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(ConfigDescPeer::CONFIG_ID, ConfigPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ConfigDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ConfigDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = ConfigDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ConfigDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Config rows - - $key2 = ConfigPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = ConfigPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ConfigPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - ConfigPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (ConfigDesc) to the collection in $obj2 (Config) - $obj2->addConfigDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(ConfigDescPeer::DATABASE_NAME)->getTable(ConfigDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseConfigDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseConfigDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new ConfigDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return ConfigDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a ConfigDesc or Criteria object. - * - * @param mixed $values Criteria or ConfigDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from ConfigDesc object - } - - if ($criteria->containsKey(ConfigDescPeer::ID) && $criteria->keyContainsValue(ConfigDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ConfigDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(ConfigDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a ConfigDesc or Criteria object. - * - * @param mixed $values Criteria or ConfigDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(ConfigDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(ConfigDescPeer::ID); - $value = $criteria->remove(ConfigDescPeer::ID); - if ($value) { - $selectCriteria->add(ConfigDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(ConfigDescPeer::TABLE_NAME); - } - - } else { // $values is ConfigDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(ConfigDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the config_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(ConfigDescPeer::TABLE_NAME, $con, ConfigDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - ConfigDescPeer::clearInstancePool(); - ConfigDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a ConfigDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or ConfigDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - ConfigDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof ConfigDesc) { // it's a model object - // invalidate the cache for this single object - ConfigDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(ConfigDescPeer::DATABASE_NAME); - $criteria->add(ConfigDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - ConfigDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(ConfigDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - ConfigDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given ConfigDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param ConfigDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(ConfigDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(ConfigDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(ConfigDescPeer::DATABASE_NAME, ConfigDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return ConfigDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = ConfigDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(ConfigDescPeer::DATABASE_NAME); - $criteria->add(ConfigDescPeer::ID, $pk); - - $v = ConfigDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return ConfigDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(ConfigDescPeer::DATABASE_NAME); - $criteria->add(ConfigDescPeer::ID, $pks, Criteria::IN); - $objs = ConfigDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseConfigDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseConfigDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseConfigDescQuery.php b/core/lib/Thelia/Model/om/BaseConfigDescQuery.php deleted file mode 100644 index 763930070..000000000 --- a/core/lib/Thelia/Model/om/BaseConfigDescQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return ConfigDesc|ConfigDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = ConfigDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ConfigDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `CONFIG_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `config_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new ConfigDesc(); - $obj->hydrate($row); - ConfigDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ConfigDesc|ConfigDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|ConfigDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(ConfigDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(ConfigDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(ConfigDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the config_id column - * - * Example usage: - * - * $query->filterByConfigId(1234); // WHERE config_id = 1234 - * $query->filterByConfigId(array(12, 34)); // WHERE config_id IN (12, 34) - * $query->filterByConfigId(array('min' => 12)); // WHERE config_id > 12 - * - * - * @see filterByConfig() - * - * @param mixed $configId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function filterByConfigId($configId = null, $comparison = null) - { - if (is_array($configId)) { - $useMinMax = false; - if (isset($configId['min'])) { - $this->addUsingAlias(ConfigDescPeer::CONFIG_ID, $configId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($configId['max'])) { - $this->addUsingAlias(ConfigDescPeer::CONFIG_ID, $configId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ConfigDescPeer::CONFIG_ID, $configId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ConfigDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ConfigDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ConfigDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ConfigDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(ConfigDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(ConfigDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ConfigDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(ConfigDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(ConfigDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ConfigDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Config object - * - * @param Config|PropelObjectCollection $config The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ConfigDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByConfig($config, $comparison = null) - { - if ($config instanceof Config) { - return $this - ->addUsingAlias(ConfigDescPeer::CONFIG_ID, $config->getId(), $comparison); - } elseif ($config instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(ConfigDescPeer::CONFIG_ID, $config->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByConfig() only accepts arguments of type Config or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Config relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function joinConfig($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Config'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Config'); - } - - return $this; - } - - /** - * Use the Config relation Config object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ConfigQuery A secondary query class using the current class as primary query - */ - public function useConfigQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinConfig($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Config', '\Thelia\Model\ConfigQuery'); - } - - /** - * Exclude object from result - * - * @param ConfigDesc $configDesc Object to remove from the list of results - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function prune($configDesc = null) - { - if ($configDesc) { - $this->addUsingAlias(ConfigDescPeer::ID, $configDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(ConfigDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(ConfigDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(ConfigDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(ConfigDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(ConfigDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return ConfigDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(ConfigDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseContentDesc.php b/core/lib/Thelia/Model/om/BaseContentDesc.php deleted file mode 100644 index fd03fd1e2..000000000 --- a/core/lib/Thelia/Model/om/BaseContentDesc.php +++ /dev/null @@ -1,1400 +0,0 @@ -id; - } - - /** - * Get the [content_id] column value. - * - * @return int - */ - public function getContentId() - { - return $this->content_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [postscriptum] column value. - * - * @return string - */ - public function getPostscriptum() - { - return $this->postscriptum; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return ContentDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = ContentDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [content_id] column. - * - * @param int $v new value - * @return ContentDesc The current object (for fluent API support) - */ - public function setContentId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->content_id !== $v) { - $this->content_id = $v; - $this->modifiedColumns[] = ContentDescPeer::CONTENT_ID; - } - - if ($this->aContent !== null && $this->aContent->getId() !== $v) { - $this->aContent = null; - } - - - return $this; - } // setContentId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return ContentDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = ContentDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return ContentDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = ContentDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return ContentDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = ContentDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return ContentDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = ContentDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Set the value of [postscriptum] column. - * - * @param string $v new value - * @return ContentDesc The current object (for fluent API support) - */ - public function setPostscriptum($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->postscriptum !== $v) { - $this->postscriptum = $v; - $this->modifiedColumns[] = ContentDescPeer::POSTSCRIPTUM; - } - - - return $this; - } // setPostscriptum() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ContentDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = ContentDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ContentDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = ContentDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->content_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->postscriptum = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->created_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->updated_at = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 9; // 9 = ContentDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating ContentDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aContent !== null && $this->content_id !== $this->aContent->getId()) { - $this->aContent = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = ContentDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aContent = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = ContentDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(ContentDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(ContentDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ContentDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - ContentDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aContent !== null) { - if ($this->aContent->isModified() || $this->aContent->isNew()) { - $affectedRows += $this->aContent->save($con); - } - $this->setContent($this->aContent); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = ContentDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ContentDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ContentDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(ContentDescPeer::CONTENT_ID)) { - $modifiedColumns[':p' . $index++] = '`CONTENT_ID`'; - } - if ($this->isColumnModified(ContentDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(ContentDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(ContentDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(ContentDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(ContentDescPeer::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; - } - if ($this->isColumnModified(ContentDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(ContentDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `content_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`CONTENT_ID`': - $stmt->bindValue($identifier, $this->content_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`POSTSCRIPTUM`': - $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aContent !== null) { - if (!$this->aContent->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aContent->getValidationFailures()); - } - } - - - if (($retval = ContentDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ContentDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getContentId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getPostscriptum(); - break; - case 7: - return $this->getCreatedAt(); - break; - case 8: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['ContentDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['ContentDesc'][$this->getPrimaryKey()] = true; - $keys = ContentDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getContentId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getPostscriptum(), - $keys[7] => $this->getCreatedAt(), - $keys[8] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aContent) { - $result['Content'] = $this->aContent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ContentDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setContentId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setPostscriptum($value); - break; - case 7: - $this->setCreatedAt($value); - break; - case 8: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = ContentDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setContentId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setPostscriptum($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(ContentDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(ContentDescPeer::ID)) $criteria->add(ContentDescPeer::ID, $this->id); - if ($this->isColumnModified(ContentDescPeer::CONTENT_ID)) $criteria->add(ContentDescPeer::CONTENT_ID, $this->content_id); - if ($this->isColumnModified(ContentDescPeer::LANG)) $criteria->add(ContentDescPeer::LANG, $this->lang); - if ($this->isColumnModified(ContentDescPeer::TITLE)) $criteria->add(ContentDescPeer::TITLE, $this->title); - if ($this->isColumnModified(ContentDescPeer::DESCRIPTION)) $criteria->add(ContentDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(ContentDescPeer::CHAPO)) $criteria->add(ContentDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(ContentDescPeer::POSTSCRIPTUM)) $criteria->add(ContentDescPeer::POSTSCRIPTUM, $this->postscriptum); - if ($this->isColumnModified(ContentDescPeer::CREATED_AT)) $criteria->add(ContentDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ContentDescPeer::UPDATED_AT)) $criteria->add(ContentDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(ContentDescPeer::DATABASE_NAME); - $criteria->add(ContentDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of ContentDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setContentId($this->getContentId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setPostscriptum($this->getPostscriptum()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return ContentDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ContentDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new ContentDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Content object. - * - * @param Content $v - * @return ContentDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setContent(Content $v = null) - { - if ($v === null) { - $this->setContentId(NULL); - } else { - $this->setContentId($v->getId()); - } - - $this->aContent = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Content object, it will not be re-added. - if ($v !== null) { - $v->addContentDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Content object - * - * @param PropelPDO $con Optional Connection object. - * @return Content The associated Content object. - * @throws PropelException - */ - public function getContent(PropelPDO $con = null) - { - if ($this->aContent === null && ($this->content_id !== null)) { - $this->aContent = ContentQuery::create()->findPk($this->content_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aContent->addContentDescs($this); - */ - } - - return $this->aContent; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->content_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->postscriptum = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aContent = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(ContentDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return ContentDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = ContentDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseContentDescPeer.php b/core/lib/Thelia/Model/om/BaseContentDescPeer.php deleted file mode 100644 index 4af41a9fd..000000000 --- a/core/lib/Thelia/Model/om/BaseContentDescPeer.php +++ /dev/null @@ -1,1042 +0,0 @@ - array ('Id', 'ContentId', 'Lang', 'Title', 'Description', 'Chapo', 'Postscriptum', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'contentId', 'lang', 'title', 'description', 'chapo', 'postscriptum', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (ContentDescPeer::ID, ContentDescPeer::CONTENT_ID, ContentDescPeer::LANG, ContentDescPeer::TITLE, ContentDescPeer::DESCRIPTION, ContentDescPeer::CHAPO, ContentDescPeer::POSTSCRIPTUM, ContentDescPeer::CREATED_AT, ContentDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CONTENT_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'content_id', 'lang', 'title', 'description', 'chapo', 'postscriptum', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. ContentDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'ContentId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'Postscriptum' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'contentId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'postscriptum' => 6, 'createdAt' => 7, 'updatedAt' => 8, ), - BasePeer::TYPE_COLNAME => array (ContentDescPeer::ID => 0, ContentDescPeer::CONTENT_ID => 1, ContentDescPeer::LANG => 2, ContentDescPeer::TITLE => 3, ContentDescPeer::DESCRIPTION => 4, ContentDescPeer::CHAPO => 5, ContentDescPeer::POSTSCRIPTUM => 6, ContentDescPeer::CREATED_AT => 7, ContentDescPeer::UPDATED_AT => 8, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CONTENT_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'POSTSCRIPTUM' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'content_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'postscriptum' => 6, 'created_at' => 7, 'updated_at' => 8, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = ContentDescPeer::getFieldNames($toType); - $key = isset(ContentDescPeer::$fieldKeys[$fromType][$name]) ? ContentDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ContentDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, ContentDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return ContentDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ContentDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(ContentDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(ContentDescPeer::ID); - $criteria->addSelectColumn(ContentDescPeer::CONTENT_ID); - $criteria->addSelectColumn(ContentDescPeer::LANG); - $criteria->addSelectColumn(ContentDescPeer::TITLE); - $criteria->addSelectColumn(ContentDescPeer::DESCRIPTION); - $criteria->addSelectColumn(ContentDescPeer::CHAPO); - $criteria->addSelectColumn(ContentDescPeer::POSTSCRIPTUM); - $criteria->addSelectColumn(ContentDescPeer::CREATED_AT); - $criteria->addSelectColumn(ContentDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.CONTENT_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.POSTSCRIPTUM'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ContentDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ContentDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(ContentDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return ContentDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = ContentDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return ContentDescPeer::populateObjects(ContentDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - ContentDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(ContentDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param ContentDesc $obj A ContentDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - ContentDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A ContentDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof ContentDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ContentDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(ContentDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return ContentDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(ContentDescPeer::$instances[$key])) { - return ContentDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - ContentDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to content_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = ContentDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = ContentDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = ContentDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - ContentDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (ContentDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = ContentDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = ContentDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + ContentDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = ContentDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - ContentDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Content table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinContent(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ContentDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ContentDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ContentDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ContentDescPeer::CONTENT_ID, ContentPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of ContentDesc objects pre-filled with their Content objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ContentDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinContent(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ContentDescPeer::DATABASE_NAME); - } - - ContentDescPeer::addSelectColumns($criteria); - $startcol = ContentDescPeer::NUM_HYDRATE_COLUMNS; - ContentPeer::addSelectColumns($criteria); - - $criteria->addJoin(ContentDescPeer::CONTENT_ID, ContentPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ContentDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ContentDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = ContentDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ContentDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = ContentPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ContentPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - ContentPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (ContentDesc) to $obj2 (Content) - $obj2->addContentDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ContentDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ContentDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ContentDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ContentDescPeer::CONTENT_ID, ContentPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of ContentDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ContentDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ContentDescPeer::DATABASE_NAME); - } - - ContentDescPeer::addSelectColumns($criteria); - $startcol2 = ContentDescPeer::NUM_HYDRATE_COLUMNS; - - ContentPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + ContentPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(ContentDescPeer::CONTENT_ID, ContentPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ContentDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ContentDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = ContentDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ContentDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Content rows - - $key2 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = ContentPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ContentPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - ContentPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (ContentDesc) to the collection in $obj2 (Content) - $obj2->addContentDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(ContentDescPeer::DATABASE_NAME)->getTable(ContentDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseContentDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseContentDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new ContentDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return ContentDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a ContentDesc or Criteria object. - * - * @param mixed $values Criteria or ContentDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from ContentDesc object - } - - if ($criteria->containsKey(ContentDescPeer::ID) && $criteria->keyContainsValue(ContentDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ContentDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(ContentDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a ContentDesc or Criteria object. - * - * @param mixed $values Criteria or ContentDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(ContentDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(ContentDescPeer::ID); - $value = $criteria->remove(ContentDescPeer::ID); - if ($value) { - $selectCriteria->add(ContentDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(ContentDescPeer::TABLE_NAME); - } - - } else { // $values is ContentDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(ContentDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the content_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(ContentDescPeer::TABLE_NAME, $con, ContentDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - ContentDescPeer::clearInstancePool(); - ContentDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a ContentDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or ContentDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - ContentDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof ContentDesc) { // it's a model object - // invalidate the cache for this single object - ContentDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(ContentDescPeer::DATABASE_NAME); - $criteria->add(ContentDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - ContentDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(ContentDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - ContentDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given ContentDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param ContentDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(ContentDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(ContentDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(ContentDescPeer::DATABASE_NAME, ContentDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return ContentDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = ContentDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(ContentDescPeer::DATABASE_NAME); - $criteria->add(ContentDescPeer::ID, $pk); - - $v = ContentDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return ContentDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(ContentDescPeer::DATABASE_NAME); - $criteria->add(ContentDescPeer::ID, $pks, Criteria::IN); - $objs = ContentDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseContentDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseContentDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseContentDescQuery.php b/core/lib/Thelia/Model/om/BaseContentDescQuery.php deleted file mode 100644 index a3f2a803d..000000000 --- a/core/lib/Thelia/Model/om/BaseContentDescQuery.php +++ /dev/null @@ -1,711 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return ContentDesc|ContentDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = ContentDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ContentDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `CONTENT_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `CREATED_AT`, `UPDATED_AT` FROM `content_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new ContentDesc(); - $obj->hydrate($row); - ContentDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ContentDesc|ContentDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|ContentDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(ContentDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(ContentDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(ContentDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the content_id column - * - * Example usage: - * - * $query->filterByContentId(1234); // WHERE content_id = 1234 - * $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34) - * $query->filterByContentId(array('min' => 12)); // WHERE content_id > 12 - * - * - * @see filterByContent() - * - * @param mixed $contentId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterByContentId($contentId = null, $comparison = null) - { - if (is_array($contentId)) { - $useMinMax = false; - if (isset($contentId['min'])) { - $this->addUsingAlias(ContentDescPeer::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($contentId['max'])) { - $this->addUsingAlias(ContentDescPeer::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ContentDescPeer::CONTENT_ID, $contentId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ContentDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ContentDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ContentDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ContentDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the postscriptum column - * - * Example usage: - * - * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue' - * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%' - * - * - * @param string $postscriptum The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterByPostscriptum($postscriptum = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($postscriptum)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $postscriptum)) { - $postscriptum = str_replace('*', '%', $postscriptum); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ContentDescPeer::POSTSCRIPTUM, $postscriptum, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(ContentDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(ContentDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ContentDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(ContentDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(ContentDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ContentDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Content object - * - * @param Content|PropelObjectCollection $content The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ContentDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByContent($content, $comparison = null) - { - if ($content instanceof Content) { - return $this - ->addUsingAlias(ContentDescPeer::CONTENT_ID, $content->getId(), $comparison); - } elseif ($content instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(ContentDescPeer::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByContent() only accepts arguments of type Content or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Content relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function joinContent($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Content'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Content'); - } - - return $this; - } - - /** - * Use the Content relation Content object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query - */ - public function useContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinContent($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery'); - } - - /** - * Exclude object from result - * - * @param ContentDesc $contentDesc Object to remove from the list of results - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function prune($contentDesc = null) - { - if ($contentDesc) { - $this->addUsingAlias(ContentDescPeer::ID, $contentDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(ContentDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(ContentDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(ContentDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(ContentDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(ContentDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return ContentDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(ContentDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseCountryDesc.php b/core/lib/Thelia/Model/om/BaseCountryDesc.php deleted file mode 100644 index 2d4bce448..000000000 --- a/core/lib/Thelia/Model/om/BaseCountryDesc.php +++ /dev/null @@ -1,1345 +0,0 @@ -id; - } - - /** - * Get the [country_id] column value. - * - * @return int - */ - public function getCountryId() - { - return $this->country_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CountryDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CountryDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [country_id] column. - * - * @param int $v new value - * @return CountryDesc The current object (for fluent API support) - */ - public function setCountryId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->country_id !== $v) { - $this->country_id = $v; - $this->modifiedColumns[] = CountryDescPeer::COUNTRY_ID; - } - - if ($this->aCountry !== null && $this->aCountry->getId() !== $v) { - $this->aCountry = null; - } - - - return $this; - } // setCountryId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return CountryDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = CountryDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return CountryDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = CountryDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return CountryDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = CountryDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return CountryDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = CountryDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return CountryDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = CountryDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return CountryDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = CountryDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->country_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->updated_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = CountryDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating CountryDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aCountry !== null && $this->country_id !== $this->aCountry->getId()) { - $this->aCountry = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CountryDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aCountry = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = CountryDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(CountryDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(CountryDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(CountryDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CountryDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCountry !== null) { - if ($this->aCountry->isModified() || $this->aCountry->isNew()) { - $affectedRows += $this->aCountry->save($con); - } - $this->setCountry($this->aCountry); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = CountryDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . CountryDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(CountryDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(CountryDescPeer::COUNTRY_ID)) { - $modifiedColumns[':p' . $index++] = '`COUNTRY_ID`'; - } - if ($this->isColumnModified(CountryDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(CountryDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(CountryDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(CountryDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(CountryDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(CountryDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `country_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`COUNTRY_ID`': - $stmt->bindValue($identifier, $this->country_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCountry !== null) { - if (!$this->aCountry->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCountry->getValidationFailures()); - } - } - - - if (($retval = CountryDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CountryDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getCountryId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['CountryDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['CountryDesc'][$this->getPrimaryKey()] = true; - $keys = CountryDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getCountryId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aCountry) { - $result['Country'] = $this->aCountry->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CountryDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setCountryId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CountryDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setCountryId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CountryDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(CountryDescPeer::ID)) $criteria->add(CountryDescPeer::ID, $this->id); - if ($this->isColumnModified(CountryDescPeer::COUNTRY_ID)) $criteria->add(CountryDescPeer::COUNTRY_ID, $this->country_id); - if ($this->isColumnModified(CountryDescPeer::LANG)) $criteria->add(CountryDescPeer::LANG, $this->lang); - if ($this->isColumnModified(CountryDescPeer::TITLE)) $criteria->add(CountryDescPeer::TITLE, $this->title); - if ($this->isColumnModified(CountryDescPeer::DESCRIPTION)) $criteria->add(CountryDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(CountryDescPeer::CHAPO)) $criteria->add(CountryDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(CountryDescPeer::CREATED_AT)) $criteria->add(CountryDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(CountryDescPeer::UPDATED_AT)) $criteria->add(CountryDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CountryDescPeer::DATABASE_NAME); - $criteria->add(CountryDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CountryDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setCountryId($this->getCountryId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CountryDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CountryDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CountryDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Country object. - * - * @param Country $v - * @return CountryDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setCountry(Country $v = null) - { - if ($v === null) { - $this->setCountryId(NULL); - } else { - $this->setCountryId($v->getId()); - } - - $this->aCountry = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Country object, it will not be re-added. - if ($v !== null) { - $v->addCountryDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Country object - * - * @param PropelPDO $con Optional Connection object. - * @return Country The associated Country object. - * @throws PropelException - */ - public function getCountry(PropelPDO $con = null) - { - if ($this->aCountry === null && ($this->country_id !== null)) { - $this->aCountry = CountryQuery::create()->findPk($this->country_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCountry->addCountryDescs($this); - */ - } - - return $this->aCountry; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->country_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aCountry = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(CountryDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return CountryDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = CountryDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseCountryDescPeer.php b/core/lib/Thelia/Model/om/BaseCountryDescPeer.php deleted file mode 100644 index 37394982f..000000000 --- a/core/lib/Thelia/Model/om/BaseCountryDescPeer.php +++ /dev/null @@ -1,1037 +0,0 @@ - array ('Id', 'CountryId', 'Lang', 'Title', 'Description', 'Chapo', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'countryId', 'lang', 'title', 'description', 'chapo', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (CountryDescPeer::ID, CountryDescPeer::COUNTRY_ID, CountryDescPeer::LANG, CountryDescPeer::TITLE, CountryDescPeer::DESCRIPTION, CountryDescPeer::CHAPO, CountryDescPeer::CREATED_AT, CountryDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'COUNTRY_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'country_id', 'lang', 'title', 'description', 'chapo', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. CountryDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'CountryId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'countryId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - BasePeer::TYPE_COLNAME => array (CountryDescPeer::ID => 0, CountryDescPeer::COUNTRY_ID => 1, CountryDescPeer::LANG => 2, CountryDescPeer::TITLE => 3, CountryDescPeer::DESCRIPTION => 4, CountryDescPeer::CHAPO => 5, CountryDescPeer::CREATED_AT => 6, CountryDescPeer::UPDATED_AT => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'COUNTRY_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'country_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'created_at' => 6, 'updated_at' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = CountryDescPeer::getFieldNames($toType); - $key = isset(CountryDescPeer::$fieldKeys[$fromType][$name]) ? CountryDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CountryDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, CountryDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return CountryDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CountryDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CountryDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CountryDescPeer::ID); - $criteria->addSelectColumn(CountryDescPeer::COUNTRY_ID); - $criteria->addSelectColumn(CountryDescPeer::LANG); - $criteria->addSelectColumn(CountryDescPeer::TITLE); - $criteria->addSelectColumn(CountryDescPeer::DESCRIPTION); - $criteria->addSelectColumn(CountryDescPeer::CHAPO); - $criteria->addSelectColumn(CountryDescPeer::CREATED_AT); - $criteria->addSelectColumn(CountryDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.COUNTRY_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CountryDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CountryDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(CountryDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CountryDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CountryDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CountryDescPeer::populateObjects(CountryDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CountryDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(CountryDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CountryDesc $obj A CountryDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - CountryDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CountryDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CountryDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CountryDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(CountryDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CountryDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(CountryDescPeer::$instances[$key])) { - return CountryDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - CountryDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to country_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CountryDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CountryDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CountryDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CountryDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CountryDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CountryDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CountryDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CountryDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = CountryDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CountryDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Country table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCountry(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CountryDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CountryDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(CountryDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CountryDescPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of CountryDesc objects pre-filled with their Country objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CountryDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCountry(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(CountryDescPeer::DATABASE_NAME); - } - - CountryDescPeer::addSelectColumns($criteria); - $startcol = CountryDescPeer::NUM_HYDRATE_COLUMNS; - CountryPeer::addSelectColumns($criteria); - - $criteria->addJoin(CountryDescPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CountryDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CountryDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CountryDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CountryDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CountryPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CountryPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CountryPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CountryDesc) to $obj2 (Country) - $obj2->addCountryDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CountryDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CountryDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(CountryDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CountryDescPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of CountryDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CountryDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(CountryDescPeer::DATABASE_NAME); - } - - CountryDescPeer::addSelectColumns($criteria); - $startcol2 = CountryDescPeer::NUM_HYDRATE_COLUMNS; - - CountryPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + CountryPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(CountryDescPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CountryDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CountryDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CountryDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CountryDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Country rows - - $key2 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CountryPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CountryPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CountryPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CountryDesc) to the collection in $obj2 (Country) - $obj2->addCountryDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(CountryDescPeer::DATABASE_NAME)->getTable(CountryDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCountryDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCountryDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new CountryDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return CountryDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a CountryDesc or Criteria object. - * - * @param mixed $values Criteria or CountryDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CountryDesc object - } - - if ($criteria->containsKey(CountryDescPeer::ID) && $criteria->keyContainsValue(CountryDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CountryDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(CountryDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a CountryDesc or Criteria object. - * - * @param mixed $values Criteria or CountryDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(CountryDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CountryDescPeer::ID); - $value = $criteria->remove(CountryDescPeer::ID); - if ($value) { - $selectCriteria->add(CountryDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CountryDescPeer::TABLE_NAME); - } - - } else { // $values is CountryDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(CountryDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the country_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CountryDescPeer::TABLE_NAME, $con, CountryDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CountryDescPeer::clearInstancePool(); - CountryDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a CountryDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CountryDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CountryDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CountryDesc) { // it's a model object - // invalidate the cache for this single object - CountryDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(CountryDescPeer::DATABASE_NAME); - $criteria->add(CountryDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CountryDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(CountryDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CountryDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CountryDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CountryDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CountryDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CountryDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CountryDescPeer::DATABASE_NAME, CountryDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CountryDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CountryDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CountryDescPeer::DATABASE_NAME); - $criteria->add(CountryDescPeer::ID, $pk); - - $v = CountryDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return CountryDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CountryDescPeer::DATABASE_NAME); - $criteria->add(CountryDescPeer::ID, $pks, Criteria::IN); - $objs = CountryDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseCountryDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCountryDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseCountryDescQuery.php b/core/lib/Thelia/Model/om/BaseCountryDescQuery.php deleted file mode 100644 index b91c7f343..000000000 --- a/core/lib/Thelia/Model/om/BaseCountryDescQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CountryDesc|CountryDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = CountryDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return CountryDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `COUNTRY_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `country_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new CountryDesc(); - $obj->hydrate($row); - CountryDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return CountryDesc|CountryDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|CountryDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(CountryDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(CountryDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(CountryDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the country_id column - * - * Example usage: - * - * $query->filterByCountryId(1234); // WHERE country_id = 1234 - * $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34) - * $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12 - * - * - * @see filterByCountry() - * - * @param mixed $countryId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function filterByCountryId($countryId = null, $comparison = null) - { - if (is_array($countryId)) { - $useMinMax = false; - if (isset($countryId['min'])) { - $this->addUsingAlias(CountryDescPeer::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($countryId['max'])) { - $this->addUsingAlias(CountryDescPeer::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CountryDescPeer::COUNTRY_ID, $countryId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CountryDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CountryDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CountryDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CountryDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(CountryDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(CountryDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CountryDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(CountryDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(CountryDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CountryDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Country object - * - * @param Country|PropelObjectCollection $country The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CountryDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByCountry($country, $comparison = null) - { - if ($country instanceof Country) { - return $this - ->addUsingAlias(CountryDescPeer::COUNTRY_ID, $country->getId(), $comparison); - } elseif ($country instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(CountryDescPeer::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByCountry() only accepts arguments of type Country or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Country relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Country'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Country'); - } - - return $this; - } - - /** - * Use the Country relation Country object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\CountryQuery A secondary query class using the current class as primary query - */ - public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinCountry($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Country', '\Thelia\Model\CountryQuery'); - } - - /** - * Exclude object from result - * - * @param CountryDesc $countryDesc Object to remove from the list of results - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function prune($countryDesc = null) - { - if ($countryDesc) { - $this->addUsingAlias(CountryDescPeer::ID, $countryDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(CountryDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(CountryDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(CountryDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(CountryDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(CountryDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return CountryDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(CountryDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseCustomerTitleDesc.php b/core/lib/Thelia/Model/om/BaseCustomerTitleDesc.php deleted file mode 100644 index 2e9a23a27..000000000 --- a/core/lib/Thelia/Model/om/BaseCustomerTitleDesc.php +++ /dev/null @@ -1,1290 +0,0 @@ -id; - } - - /** - * Get the [customer_title_id] column value. - * - * @return int - */ - public function getCustomerTitleId() - { - return $this->customer_title_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [short] column value. - * - * @return string - */ - public function getShort() - { - return $this->short; - } - - /** - * Get the [long] column value. - * - * @return string - */ - public function getLong() - { - return $this->long; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CustomerTitleDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CustomerTitleDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [customer_title_id] column. - * - * @param int $v new value - * @return CustomerTitleDesc The current object (for fluent API support) - */ - public function setCustomerTitleId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->customer_title_id !== $v) { - $this->customer_title_id = $v; - $this->modifiedColumns[] = CustomerTitleDescPeer::CUSTOMER_TITLE_ID; - } - - if ($this->aCustomerTitle !== null && $this->aCustomerTitle->getId() !== $v) { - $this->aCustomerTitle = null; - } - - - return $this; - } // setCustomerTitleId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return CustomerTitleDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = CustomerTitleDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [short] column. - * - * @param string $v new value - * @return CustomerTitleDesc The current object (for fluent API support) - */ - public function setShort($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->short !== $v) { - $this->short = $v; - $this->modifiedColumns[] = CustomerTitleDescPeer::SHORT; - } - - - return $this; - } // setShort() - - /** - * Set the value of [long] column. - * - * @param string $v new value - * @return CustomerTitleDesc The current object (for fluent API support) - */ - public function setLong($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->long !== $v) { - $this->long = $v; - $this->modifiedColumns[] = CustomerTitleDescPeer::LONG; - } - - - return $this; - } // setLong() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return CustomerTitleDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = CustomerTitleDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return CustomerTitleDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = CustomerTitleDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->customer_title_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->short = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->long = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->created_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->updated_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 7; // 7 = CustomerTitleDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating CustomerTitleDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aCustomerTitle !== null && $this->customer_title_id !== $this->aCustomerTitle->getId()) { - $this->aCustomerTitle = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CustomerTitleDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aCustomerTitle = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = CustomerTitleDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(CustomerTitleDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(CustomerTitleDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(CustomerTitleDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CustomerTitleDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCustomerTitle !== null) { - if ($this->aCustomerTitle->isModified() || $this->aCustomerTitle->isNew()) { - $affectedRows += $this->aCustomerTitle->save($con); - } - $this->setCustomerTitle($this->aCustomerTitle); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = CustomerTitleDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . CustomerTitleDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(CustomerTitleDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(CustomerTitleDescPeer::CUSTOMER_TITLE_ID)) { - $modifiedColumns[':p' . $index++] = '`CUSTOMER_TITLE_ID`'; - } - if ($this->isColumnModified(CustomerTitleDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(CustomerTitleDescPeer::SHORT)) { - $modifiedColumns[':p' . $index++] = '`SHORT`'; - } - if ($this->isColumnModified(CustomerTitleDescPeer::LONG)) { - $modifiedColumns[':p' . $index++] = '`LONG`'; - } - if ($this->isColumnModified(CustomerTitleDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(CustomerTitleDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `customer_title_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`CUSTOMER_TITLE_ID`': - $stmt->bindValue($identifier, $this->customer_title_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`SHORT`': - $stmt->bindValue($identifier, $this->short, PDO::PARAM_STR); - break; - case '`LONG`': - $stmt->bindValue($identifier, $this->long, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCustomerTitle !== null) { - if (!$this->aCustomerTitle->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCustomerTitle->getValidationFailures()); - } - } - - - if (($retval = CustomerTitleDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CustomerTitleDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getCustomerTitleId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getShort(); - break; - case 4: - return $this->getLong(); - break; - case 5: - return $this->getCreatedAt(); - break; - case 6: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['CustomerTitleDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['CustomerTitleDesc'][$this->getPrimaryKey()] = true; - $keys = CustomerTitleDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getCustomerTitleId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getShort(), - $keys[4] => $this->getLong(), - $keys[5] => $this->getCreatedAt(), - $keys[6] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aCustomerTitle) { - $result['CustomerTitle'] = $this->aCustomerTitle->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CustomerTitleDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setCustomerTitleId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setShort($value); - break; - case 4: - $this->setLong($value); - break; - case 5: - $this->setCreatedAt($value); - break; - case 6: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CustomerTitleDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setCustomerTitleId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setShort($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setLong($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CustomerTitleDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(CustomerTitleDescPeer::ID)) $criteria->add(CustomerTitleDescPeer::ID, $this->id); - if ($this->isColumnModified(CustomerTitleDescPeer::CUSTOMER_TITLE_ID)) $criteria->add(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $this->customer_title_id); - if ($this->isColumnModified(CustomerTitleDescPeer::LANG)) $criteria->add(CustomerTitleDescPeer::LANG, $this->lang); - if ($this->isColumnModified(CustomerTitleDescPeer::SHORT)) $criteria->add(CustomerTitleDescPeer::SHORT, $this->short); - if ($this->isColumnModified(CustomerTitleDescPeer::LONG)) $criteria->add(CustomerTitleDescPeer::LONG, $this->long); - if ($this->isColumnModified(CustomerTitleDescPeer::CREATED_AT)) $criteria->add(CustomerTitleDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(CustomerTitleDescPeer::UPDATED_AT)) $criteria->add(CustomerTitleDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CustomerTitleDescPeer::DATABASE_NAME); - $criteria->add(CustomerTitleDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CustomerTitleDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setCustomerTitleId($this->getCustomerTitleId()); - $copyObj->setLang($this->getLang()); - $copyObj->setShort($this->getShort()); - $copyObj->setLong($this->getLong()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CustomerTitleDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CustomerTitleDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CustomerTitleDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a CustomerTitle object. - * - * @param CustomerTitle $v - * @return CustomerTitleDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setCustomerTitle(CustomerTitle $v = null) - { - if ($v === null) { - $this->setCustomerTitleId(NULL); - } else { - $this->setCustomerTitleId($v->getId()); - } - - $this->aCustomerTitle = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CustomerTitle object, it will not be re-added. - if ($v !== null) { - $v->addCustomerTitleDesc($this); - } - - - return $this; - } - - - /** - * Get the associated CustomerTitle object - * - * @param PropelPDO $con Optional Connection object. - * @return CustomerTitle The associated CustomerTitle object. - * @throws PropelException - */ - public function getCustomerTitle(PropelPDO $con = null) - { - if ($this->aCustomerTitle === null && ($this->customer_title_id !== null)) { - $this->aCustomerTitle = CustomerTitleQuery::create()->findPk($this->customer_title_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCustomerTitle->addCustomerTitleDescs($this); - */ - } - - return $this->aCustomerTitle; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->customer_title_id = null; - $this->lang = null; - $this->short = null; - $this->long = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aCustomerTitle = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(CustomerTitleDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return CustomerTitleDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = CustomerTitleDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseCustomerTitleDescPeer.php b/core/lib/Thelia/Model/om/BaseCustomerTitleDescPeer.php deleted file mode 100644 index 0f5f901aa..000000000 --- a/core/lib/Thelia/Model/om/BaseCustomerTitleDescPeer.php +++ /dev/null @@ -1,1032 +0,0 @@ - array ('Id', 'CustomerTitleId', 'Lang', 'Short', 'Long', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'customerTitleId', 'lang', 'short', 'long', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (CustomerTitleDescPeer::ID, CustomerTitleDescPeer::CUSTOMER_TITLE_ID, CustomerTitleDescPeer::LANG, CustomerTitleDescPeer::SHORT, CustomerTitleDescPeer::LONG, CustomerTitleDescPeer::CREATED_AT, CustomerTitleDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CUSTOMER_TITLE_ID', 'LANG', 'SHORT', 'LONG', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'customer_title_id', 'lang', 'short', 'long', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. CustomerTitleDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'CustomerTitleId' => 1, 'Lang' => 2, 'Short' => 3, 'Long' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'customerTitleId' => 1, 'lang' => 2, 'short' => 3, 'long' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - BasePeer::TYPE_COLNAME => array (CustomerTitleDescPeer::ID => 0, CustomerTitleDescPeer::CUSTOMER_TITLE_ID => 1, CustomerTitleDescPeer::LANG => 2, CustomerTitleDescPeer::SHORT => 3, CustomerTitleDescPeer::LONG => 4, CustomerTitleDescPeer::CREATED_AT => 5, CustomerTitleDescPeer::UPDATED_AT => 6, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CUSTOMER_TITLE_ID' => 1, 'LANG' => 2, 'SHORT' => 3, 'LONG' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'customer_title_id' => 1, 'lang' => 2, 'short' => 3, 'long' => 4, 'created_at' => 5, 'updated_at' => 6, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = CustomerTitleDescPeer::getFieldNames($toType); - $key = isset(CustomerTitleDescPeer::$fieldKeys[$fromType][$name]) ? CustomerTitleDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CustomerTitleDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, CustomerTitleDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return CustomerTitleDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CustomerTitleDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CustomerTitleDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CustomerTitleDescPeer::ID); - $criteria->addSelectColumn(CustomerTitleDescPeer::CUSTOMER_TITLE_ID); - $criteria->addSelectColumn(CustomerTitleDescPeer::LANG); - $criteria->addSelectColumn(CustomerTitleDescPeer::SHORT); - $criteria->addSelectColumn(CustomerTitleDescPeer::LONG); - $criteria->addSelectColumn(CustomerTitleDescPeer::CREATED_AT); - $criteria->addSelectColumn(CustomerTitleDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.CUSTOMER_TITLE_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.SHORT'); - $criteria->addSelectColumn($alias . '.LONG'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CustomerTitleDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CustomerTitleDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(CustomerTitleDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CustomerTitleDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CustomerTitleDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CustomerTitleDescPeer::populateObjects(CustomerTitleDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CustomerTitleDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(CustomerTitleDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CustomerTitleDesc $obj A CustomerTitleDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - CustomerTitleDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CustomerTitleDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CustomerTitleDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CustomerTitleDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(CustomerTitleDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CustomerTitleDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(CustomerTitleDescPeer::$instances[$key])) { - return CustomerTitleDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - CustomerTitleDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to customer_title_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CustomerTitleDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CustomerTitleDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CustomerTitleDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CustomerTitleDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CustomerTitleDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CustomerTitleDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CustomerTitleDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CustomerTitleDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = CustomerTitleDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CustomerTitleDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related CustomerTitle table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCustomerTitle(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CustomerTitleDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CustomerTitleDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(CustomerTitleDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of CustomerTitleDesc objects pre-filled with their CustomerTitle objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CustomerTitleDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCustomerTitle(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(CustomerTitleDescPeer::DATABASE_NAME); - } - - CustomerTitleDescPeer::addSelectColumns($criteria); - $startcol = CustomerTitleDescPeer::NUM_HYDRATE_COLUMNS; - CustomerTitlePeer::addSelectColumns($criteria); - - $criteria->addJoin(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CustomerTitleDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CustomerTitleDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CustomerTitleDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CustomerTitleDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CustomerTitlePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CustomerTitlePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CustomerTitlePeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CustomerTitleDesc) to $obj2 (CustomerTitle) - $obj2->addCustomerTitleDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CustomerTitleDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CustomerTitleDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(CustomerTitleDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of CustomerTitleDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CustomerTitleDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(CustomerTitleDescPeer::DATABASE_NAME); - } - - CustomerTitleDescPeer::addSelectColumns($criteria); - $startcol2 = CustomerTitleDescPeer::NUM_HYDRATE_COLUMNS; - - CustomerTitlePeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + CustomerTitlePeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CustomerTitleDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CustomerTitleDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CustomerTitleDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CustomerTitleDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CustomerTitle rows - - $key2 = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CustomerTitlePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CustomerTitlePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CustomerTitlePeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CustomerTitleDesc) to the collection in $obj2 (CustomerTitle) - $obj2->addCustomerTitleDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(CustomerTitleDescPeer::DATABASE_NAME)->getTable(CustomerTitleDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCustomerTitleDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCustomerTitleDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new CustomerTitleDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return CustomerTitleDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a CustomerTitleDesc or Criteria object. - * - * @param mixed $values Criteria or CustomerTitleDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CustomerTitleDesc object - } - - if ($criteria->containsKey(CustomerTitleDescPeer::ID) && $criteria->keyContainsValue(CustomerTitleDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CustomerTitleDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(CustomerTitleDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a CustomerTitleDesc or Criteria object. - * - * @param mixed $values Criteria or CustomerTitleDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(CustomerTitleDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CustomerTitleDescPeer::ID); - $value = $criteria->remove(CustomerTitleDescPeer::ID); - if ($value) { - $selectCriteria->add(CustomerTitleDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CustomerTitleDescPeer::TABLE_NAME); - } - - } else { // $values is CustomerTitleDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(CustomerTitleDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the customer_title_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CustomerTitleDescPeer::TABLE_NAME, $con, CustomerTitleDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CustomerTitleDescPeer::clearInstancePool(); - CustomerTitleDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a CustomerTitleDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CustomerTitleDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CustomerTitleDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CustomerTitleDesc) { // it's a model object - // invalidate the cache for this single object - CustomerTitleDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(CustomerTitleDescPeer::DATABASE_NAME); - $criteria->add(CustomerTitleDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CustomerTitleDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(CustomerTitleDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CustomerTitleDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CustomerTitleDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CustomerTitleDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CustomerTitleDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CustomerTitleDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CustomerTitleDescPeer::DATABASE_NAME, CustomerTitleDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CustomerTitleDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CustomerTitleDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CustomerTitleDescPeer::DATABASE_NAME); - $criteria->add(CustomerTitleDescPeer::ID, $pk); - - $v = CustomerTitleDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return CustomerTitleDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CustomerTitleDescPeer::DATABASE_NAME); - $criteria->add(CustomerTitleDescPeer::ID, $pks, Criteria::IN); - $objs = CustomerTitleDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseCustomerTitleDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCustomerTitleDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseCustomerTitleDescQuery.php b/core/lib/Thelia/Model/om/BaseCustomerTitleDescQuery.php deleted file mode 100644 index fa4ce5bc8..000000000 --- a/core/lib/Thelia/Model/om/BaseCustomerTitleDescQuery.php +++ /dev/null @@ -1,645 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CustomerTitleDesc|CustomerTitleDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = CustomerTitleDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return CustomerTitleDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `CUSTOMER_TITLE_ID`, `LANG`, `SHORT`, `LONG`, `CREATED_AT`, `UPDATED_AT` FROM `customer_title_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new CustomerTitleDesc(); - $obj->hydrate($row); - CustomerTitleDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return CustomerTitleDesc|CustomerTitleDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|CustomerTitleDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(CustomerTitleDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(CustomerTitleDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(CustomerTitleDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the customer_title_id column - * - * Example usage: - * - * $query->filterByCustomerTitleId(1234); // WHERE customer_title_id = 1234 - * $query->filterByCustomerTitleId(array(12, 34)); // WHERE customer_title_id IN (12, 34) - * $query->filterByCustomerTitleId(array('min' => 12)); // WHERE customer_title_id > 12 - * - * - * @see filterByCustomerTitle() - * - * @param mixed $customerTitleId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function filterByCustomerTitleId($customerTitleId = null, $comparison = null) - { - if (is_array($customerTitleId)) { - $useMinMax = false; - if (isset($customerTitleId['min'])) { - $this->addUsingAlias(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $customerTitleId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($customerTitleId['max'])) { - $this->addUsingAlias(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $customerTitleId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $customerTitleId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CustomerTitleDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the short column - * - * Example usage: - * - * $query->filterByShort('fooValue'); // WHERE short = 'fooValue' - * $query->filterByShort('%fooValue%'); // WHERE short LIKE '%fooValue%' - * - * - * @param string $short The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function filterByShort($short = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($short)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $short)) { - $short = str_replace('*', '%', $short); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CustomerTitleDescPeer::SHORT, $short, $comparison); - } - - /** - * Filter the query on the long column - * - * Example usage: - * - * $query->filterByLong('fooValue'); // WHERE long = 'fooValue' - * $query->filterByLong('%fooValue%'); // WHERE long LIKE '%fooValue%' - * - * - * @param string $long The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function filterByLong($long = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($long)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $long)) { - $long = str_replace('*', '%', $long); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CustomerTitleDescPeer::LONG, $long, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(CustomerTitleDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(CustomerTitleDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CustomerTitleDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(CustomerTitleDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(CustomerTitleDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CustomerTitleDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related CustomerTitle object - * - * @param CustomerTitle|PropelObjectCollection $customerTitle The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CustomerTitleDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByCustomerTitle($customerTitle, $comparison = null) - { - if ($customerTitle instanceof CustomerTitle) { - return $this - ->addUsingAlias(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $customerTitle->getId(), $comparison); - } elseif ($customerTitle instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByCustomerTitle() only accepts arguments of type CustomerTitle or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the CustomerTitle relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CustomerTitle'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CustomerTitle'); - } - - return $this; - } - - /** - * Use the CustomerTitle relation CustomerTitle object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\CustomerTitleQuery A secondary query class using the current class as primary query - */ - public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinCustomerTitle($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\Thelia\Model\CustomerTitleQuery'); - } - - /** - * Exclude object from result - * - * @param CustomerTitleDesc $customerTitleDesc Object to remove from the list of results - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function prune($customerTitleDesc = null) - { - if ($customerTitleDesc) { - $this->addUsingAlias(CustomerTitleDescPeer::ID, $customerTitleDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(CustomerTitleDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(CustomerTitleDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(CustomerTitleDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(CustomerTitleDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(CustomerTitleDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return CustomerTitleDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(CustomerTitleDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseDocumentDesc.php b/core/lib/Thelia/Model/om/BaseDocumentDesc.php deleted file mode 100644 index 74787a12e..000000000 --- a/core/lib/Thelia/Model/om/BaseDocumentDesc.php +++ /dev/null @@ -1,1345 +0,0 @@ -id; - } - - /** - * Get the [document_id] column value. - * - * @return int - */ - public function getDocumentId() - { - return $this->document_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return DocumentDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = DocumentDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [document_id] column. - * - * @param int $v new value - * @return DocumentDesc The current object (for fluent API support) - */ - public function setDocumentId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->document_id !== $v) { - $this->document_id = $v; - $this->modifiedColumns[] = DocumentDescPeer::DOCUMENT_ID; - } - - if ($this->aDocument !== null && $this->aDocument->getId() !== $v) { - $this->aDocument = null; - } - - - return $this; - } // setDocumentId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return DocumentDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = DocumentDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return DocumentDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = DocumentDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return DocumentDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = DocumentDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return DocumentDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = DocumentDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return DocumentDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = DocumentDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return DocumentDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = DocumentDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->document_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->updated_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = DocumentDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating DocumentDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aDocument !== null && $this->document_id !== $this->aDocument->getId()) { - $this->aDocument = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = DocumentDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aDocument = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = DocumentDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(DocumentDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(DocumentDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(DocumentDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - DocumentDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aDocument !== null) { - if ($this->aDocument->isModified() || $this->aDocument->isNew()) { - $affectedRows += $this->aDocument->save($con); - } - $this->setDocument($this->aDocument); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = DocumentDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . DocumentDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(DocumentDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(DocumentDescPeer::DOCUMENT_ID)) { - $modifiedColumns[':p' . $index++] = '`DOCUMENT_ID`'; - } - if ($this->isColumnModified(DocumentDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(DocumentDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(DocumentDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(DocumentDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(DocumentDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(DocumentDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `document_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`DOCUMENT_ID`': - $stmt->bindValue($identifier, $this->document_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aDocument !== null) { - if (!$this->aDocument->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aDocument->getValidationFailures()); - } - } - - - if (($retval = DocumentDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = DocumentDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getDocumentId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['DocumentDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['DocumentDesc'][$this->getPrimaryKey()] = true; - $keys = DocumentDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getDocumentId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aDocument) { - $result['Document'] = $this->aDocument->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = DocumentDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setDocumentId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = DocumentDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setDocumentId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(DocumentDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(DocumentDescPeer::ID)) $criteria->add(DocumentDescPeer::ID, $this->id); - if ($this->isColumnModified(DocumentDescPeer::DOCUMENT_ID)) $criteria->add(DocumentDescPeer::DOCUMENT_ID, $this->document_id); - if ($this->isColumnModified(DocumentDescPeer::LANG)) $criteria->add(DocumentDescPeer::LANG, $this->lang); - if ($this->isColumnModified(DocumentDescPeer::TITLE)) $criteria->add(DocumentDescPeer::TITLE, $this->title); - if ($this->isColumnModified(DocumentDescPeer::DESCRIPTION)) $criteria->add(DocumentDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(DocumentDescPeer::CHAPO)) $criteria->add(DocumentDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(DocumentDescPeer::CREATED_AT)) $criteria->add(DocumentDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(DocumentDescPeer::UPDATED_AT)) $criteria->add(DocumentDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(DocumentDescPeer::DATABASE_NAME); - $criteria->add(DocumentDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of DocumentDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setDocumentId($this->getDocumentId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return DocumentDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return DocumentDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new DocumentDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Document object. - * - * @param Document $v - * @return DocumentDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setDocument(Document $v = null) - { - if ($v === null) { - $this->setDocumentId(NULL); - } else { - $this->setDocumentId($v->getId()); - } - - $this->aDocument = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Document object, it will not be re-added. - if ($v !== null) { - $v->addDocumentDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Document object - * - * @param PropelPDO $con Optional Connection object. - * @return Document The associated Document object. - * @throws PropelException - */ - public function getDocument(PropelPDO $con = null) - { - if ($this->aDocument === null && ($this->document_id !== null)) { - $this->aDocument = DocumentQuery::create()->findPk($this->document_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aDocument->addDocumentDescs($this); - */ - } - - return $this->aDocument; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->document_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aDocument = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(DocumentDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return DocumentDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = DocumentDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseDocumentDescPeer.php b/core/lib/Thelia/Model/om/BaseDocumentDescPeer.php deleted file mode 100644 index 013588697..000000000 --- a/core/lib/Thelia/Model/om/BaseDocumentDescPeer.php +++ /dev/null @@ -1,1037 +0,0 @@ - array ('Id', 'DocumentId', 'Lang', 'Title', 'Description', 'Chapo', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'documentId', 'lang', 'title', 'description', 'chapo', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (DocumentDescPeer::ID, DocumentDescPeer::DOCUMENT_ID, DocumentDescPeer::LANG, DocumentDescPeer::TITLE, DocumentDescPeer::DESCRIPTION, DocumentDescPeer::CHAPO, DocumentDescPeer::CREATED_AT, DocumentDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DOCUMENT_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'document_id', 'lang', 'title', 'description', 'chapo', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. DocumentDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'DocumentId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'documentId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - BasePeer::TYPE_COLNAME => array (DocumentDescPeer::ID => 0, DocumentDescPeer::DOCUMENT_ID => 1, DocumentDescPeer::LANG => 2, DocumentDescPeer::TITLE => 3, DocumentDescPeer::DESCRIPTION => 4, DocumentDescPeer::CHAPO => 5, DocumentDescPeer::CREATED_AT => 6, DocumentDescPeer::UPDATED_AT => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DOCUMENT_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'document_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'created_at' => 6, 'updated_at' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = DocumentDescPeer::getFieldNames($toType); - $key = isset(DocumentDescPeer::$fieldKeys[$fromType][$name]) ? DocumentDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(DocumentDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, DocumentDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return DocumentDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. DocumentDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(DocumentDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(DocumentDescPeer::ID); - $criteria->addSelectColumn(DocumentDescPeer::DOCUMENT_ID); - $criteria->addSelectColumn(DocumentDescPeer::LANG); - $criteria->addSelectColumn(DocumentDescPeer::TITLE); - $criteria->addSelectColumn(DocumentDescPeer::DESCRIPTION); - $criteria->addSelectColumn(DocumentDescPeer::CHAPO); - $criteria->addSelectColumn(DocumentDescPeer::CREATED_AT); - $criteria->addSelectColumn(DocumentDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.DOCUMENT_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(DocumentDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - DocumentDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(DocumentDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return DocumentDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = DocumentDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return DocumentDescPeer::populateObjects(DocumentDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - DocumentDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(DocumentDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param DocumentDesc $obj A DocumentDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - DocumentDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A DocumentDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof DocumentDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or DocumentDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(DocumentDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return DocumentDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(DocumentDescPeer::$instances[$key])) { - return DocumentDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - DocumentDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to document_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = DocumentDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = DocumentDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = DocumentDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - DocumentDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (DocumentDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = DocumentDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = DocumentDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + DocumentDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = DocumentDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - DocumentDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Document table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinDocument(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(DocumentDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - DocumentDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(DocumentDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(DocumentDescPeer::DOCUMENT_ID, DocumentPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of DocumentDesc objects pre-filled with their Document objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of DocumentDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinDocument(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(DocumentDescPeer::DATABASE_NAME); - } - - DocumentDescPeer::addSelectColumns($criteria); - $startcol = DocumentDescPeer::NUM_HYDRATE_COLUMNS; - DocumentPeer::addSelectColumns($criteria); - - $criteria->addJoin(DocumentDescPeer::DOCUMENT_ID, DocumentPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = DocumentDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = DocumentDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = DocumentDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - DocumentDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = DocumentPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = DocumentPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = DocumentPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - DocumentPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (DocumentDesc) to $obj2 (Document) - $obj2->addDocumentDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(DocumentDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - DocumentDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(DocumentDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(DocumentDescPeer::DOCUMENT_ID, DocumentPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of DocumentDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of DocumentDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(DocumentDescPeer::DATABASE_NAME); - } - - DocumentDescPeer::addSelectColumns($criteria); - $startcol2 = DocumentDescPeer::NUM_HYDRATE_COLUMNS; - - DocumentPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + DocumentPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(DocumentDescPeer::DOCUMENT_ID, DocumentPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = DocumentDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = DocumentDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = DocumentDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - DocumentDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Document rows - - $key2 = DocumentPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = DocumentPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = DocumentPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - DocumentPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (DocumentDesc) to the collection in $obj2 (Document) - $obj2->addDocumentDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(DocumentDescPeer::DATABASE_NAME)->getTable(DocumentDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseDocumentDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseDocumentDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new DocumentDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return DocumentDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a DocumentDesc or Criteria object. - * - * @param mixed $values Criteria or DocumentDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from DocumentDesc object - } - - if ($criteria->containsKey(DocumentDescPeer::ID) && $criteria->keyContainsValue(DocumentDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.DocumentDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(DocumentDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a DocumentDesc or Criteria object. - * - * @param mixed $values Criteria or DocumentDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(DocumentDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(DocumentDescPeer::ID); - $value = $criteria->remove(DocumentDescPeer::ID); - if ($value) { - $selectCriteria->add(DocumentDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(DocumentDescPeer::TABLE_NAME); - } - - } else { // $values is DocumentDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(DocumentDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the document_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(DocumentDescPeer::TABLE_NAME, $con, DocumentDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - DocumentDescPeer::clearInstancePool(); - DocumentDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a DocumentDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or DocumentDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - DocumentDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof DocumentDesc) { // it's a model object - // invalidate the cache for this single object - DocumentDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(DocumentDescPeer::DATABASE_NAME); - $criteria->add(DocumentDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - DocumentDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(DocumentDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - DocumentDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given DocumentDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param DocumentDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(DocumentDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(DocumentDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(DocumentDescPeer::DATABASE_NAME, DocumentDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return DocumentDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = DocumentDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(DocumentDescPeer::DATABASE_NAME); - $criteria->add(DocumentDescPeer::ID, $pk); - - $v = DocumentDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return DocumentDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(DocumentDescPeer::DATABASE_NAME); - $criteria->add(DocumentDescPeer::ID, $pks, Criteria::IN); - $objs = DocumentDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseDocumentDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseDocumentDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseDocumentDescQuery.php b/core/lib/Thelia/Model/om/BaseDocumentDescQuery.php deleted file mode 100644 index 625df55ab..000000000 --- a/core/lib/Thelia/Model/om/BaseDocumentDescQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return DocumentDesc|DocumentDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = DocumentDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return DocumentDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `DOCUMENT_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `document_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new DocumentDesc(); - $obj->hydrate($row); - DocumentDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return DocumentDesc|DocumentDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|DocumentDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(DocumentDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(DocumentDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(DocumentDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the document_id column - * - * Example usage: - * - * $query->filterByDocumentId(1234); // WHERE document_id = 1234 - * $query->filterByDocumentId(array(12, 34)); // WHERE document_id IN (12, 34) - * $query->filterByDocumentId(array('min' => 12)); // WHERE document_id > 12 - * - * - * @see filterByDocument() - * - * @param mixed $documentId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function filterByDocumentId($documentId = null, $comparison = null) - { - if (is_array($documentId)) { - $useMinMax = false; - if (isset($documentId['min'])) { - $this->addUsingAlias(DocumentDescPeer::DOCUMENT_ID, $documentId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($documentId['max'])) { - $this->addUsingAlias(DocumentDescPeer::DOCUMENT_ID, $documentId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(DocumentDescPeer::DOCUMENT_ID, $documentId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(DocumentDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(DocumentDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(DocumentDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(DocumentDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(DocumentDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(DocumentDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(DocumentDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(DocumentDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(DocumentDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(DocumentDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Document object - * - * @param Document|PropelObjectCollection $document The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return DocumentDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByDocument($document, $comparison = null) - { - if ($document instanceof Document) { - return $this - ->addUsingAlias(DocumentDescPeer::DOCUMENT_ID, $document->getId(), $comparison); - } elseif ($document instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(DocumentDescPeer::DOCUMENT_ID, $document->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByDocument() only accepts arguments of type Document or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Document relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function joinDocument($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Document'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Document'); - } - - return $this; - } - - /** - * Use the Document relation Document object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\DocumentQuery A secondary query class using the current class as primary query - */ - public function useDocumentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinDocument($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Document', '\Thelia\Model\DocumentQuery'); - } - - /** - * Exclude object from result - * - * @param DocumentDesc $documentDesc Object to remove from the list of results - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function prune($documentDesc = null) - { - if ($documentDesc) { - $this->addUsingAlias(DocumentDescPeer::ID, $documentDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(DocumentDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(DocumentDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(DocumentDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(DocumentDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(DocumentDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return DocumentDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(DocumentDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseFeatureAvDesc.php b/core/lib/Thelia/Model/om/BaseFeatureAvDesc.php deleted file mode 100644 index ae82494f8..000000000 --- a/core/lib/Thelia/Model/om/BaseFeatureAvDesc.php +++ /dev/null @@ -1,1345 +0,0 @@ -id; - } - - /** - * Get the [feature_av_id] column value. - * - * @return int - */ - public function getFeatureAvId() - { - return $this->feature_av_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return FeatureAvDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = FeatureAvDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [feature_av_id] column. - * - * @param int $v new value - * @return FeatureAvDesc The current object (for fluent API support) - */ - public function setFeatureAvId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->feature_av_id !== $v) { - $this->feature_av_id = $v; - $this->modifiedColumns[] = FeatureAvDescPeer::FEATURE_AV_ID; - } - - if ($this->aFeatureAv !== null && $this->aFeatureAv->getId() !== $v) { - $this->aFeatureAv = null; - } - - - return $this; - } // setFeatureAvId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return FeatureAvDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = FeatureAvDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return FeatureAvDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = FeatureAvDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return FeatureAvDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = FeatureAvDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return FeatureAvDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = FeatureAvDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return FeatureAvDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = FeatureAvDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return FeatureAvDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = FeatureAvDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->feature_av_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->updated_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = FeatureAvDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating FeatureAvDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aFeatureAv !== null && $this->feature_av_id !== $this->aFeatureAv->getId()) { - $this->aFeatureAv = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = FeatureAvDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aFeatureAv = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = FeatureAvDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(FeatureAvDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(FeatureAvDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(FeatureAvDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - FeatureAvDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aFeatureAv !== null) { - if ($this->aFeatureAv->isModified() || $this->aFeatureAv->isNew()) { - $affectedRows += $this->aFeatureAv->save($con); - } - $this->setFeatureAv($this->aFeatureAv); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = FeatureAvDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . FeatureAvDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(FeatureAvDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(FeatureAvDescPeer::FEATURE_AV_ID)) { - $modifiedColumns[':p' . $index++] = '`FEATURE_AV_ID`'; - } - if ($this->isColumnModified(FeatureAvDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(FeatureAvDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(FeatureAvDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(FeatureAvDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(FeatureAvDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(FeatureAvDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `feature_av_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`FEATURE_AV_ID`': - $stmt->bindValue($identifier, $this->feature_av_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aFeatureAv !== null) { - if (!$this->aFeatureAv->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aFeatureAv->getValidationFailures()); - } - } - - - if (($retval = FeatureAvDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = FeatureAvDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getFeatureAvId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['FeatureAvDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['FeatureAvDesc'][$this->getPrimaryKey()] = true; - $keys = FeatureAvDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getFeatureAvId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aFeatureAv) { - $result['FeatureAv'] = $this->aFeatureAv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = FeatureAvDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setFeatureAvId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = FeatureAvDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setFeatureAvId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(FeatureAvDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(FeatureAvDescPeer::ID)) $criteria->add(FeatureAvDescPeer::ID, $this->id); - if ($this->isColumnModified(FeatureAvDescPeer::FEATURE_AV_ID)) $criteria->add(FeatureAvDescPeer::FEATURE_AV_ID, $this->feature_av_id); - if ($this->isColumnModified(FeatureAvDescPeer::LANG)) $criteria->add(FeatureAvDescPeer::LANG, $this->lang); - if ($this->isColumnModified(FeatureAvDescPeer::TITLE)) $criteria->add(FeatureAvDescPeer::TITLE, $this->title); - if ($this->isColumnModified(FeatureAvDescPeer::DESCRIPTION)) $criteria->add(FeatureAvDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(FeatureAvDescPeer::CHAPO)) $criteria->add(FeatureAvDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(FeatureAvDescPeer::CREATED_AT)) $criteria->add(FeatureAvDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(FeatureAvDescPeer::UPDATED_AT)) $criteria->add(FeatureAvDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(FeatureAvDescPeer::DATABASE_NAME); - $criteria->add(FeatureAvDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of FeatureAvDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setFeatureAvId($this->getFeatureAvId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return FeatureAvDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return FeatureAvDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new FeatureAvDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a FeatureAv object. - * - * @param FeatureAv $v - * @return FeatureAvDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setFeatureAv(FeatureAv $v = null) - { - if ($v === null) { - $this->setFeatureAvId(NULL); - } else { - $this->setFeatureAvId($v->getId()); - } - - $this->aFeatureAv = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the FeatureAv object, it will not be re-added. - if ($v !== null) { - $v->addFeatureAvDesc($this); - } - - - return $this; - } - - - /** - * Get the associated FeatureAv object - * - * @param PropelPDO $con Optional Connection object. - * @return FeatureAv The associated FeatureAv object. - * @throws PropelException - */ - public function getFeatureAv(PropelPDO $con = null) - { - if ($this->aFeatureAv === null && ($this->feature_av_id !== null)) { - $this->aFeatureAv = FeatureAvQuery::create()->findPk($this->feature_av_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aFeatureAv->addFeatureAvDescs($this); - */ - } - - return $this->aFeatureAv; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->feature_av_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aFeatureAv = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(FeatureAvDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return FeatureAvDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = FeatureAvDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseFeatureAvDescPeer.php b/core/lib/Thelia/Model/om/BaseFeatureAvDescPeer.php deleted file mode 100644 index 629e08ec9..000000000 --- a/core/lib/Thelia/Model/om/BaseFeatureAvDescPeer.php +++ /dev/null @@ -1,1037 +0,0 @@ - array ('Id', 'FeatureAvId', 'Lang', 'Title', 'Description', 'Chapo', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'featureAvId', 'lang', 'title', 'description', 'chapo', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (FeatureAvDescPeer::ID, FeatureAvDescPeer::FEATURE_AV_ID, FeatureAvDescPeer::LANG, FeatureAvDescPeer::TITLE, FeatureAvDescPeer::DESCRIPTION, FeatureAvDescPeer::CHAPO, FeatureAvDescPeer::CREATED_AT, FeatureAvDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FEATURE_AV_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'feature_av_id', 'lang', 'title', 'description', 'chapo', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. FeatureAvDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FeatureAvId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'featureAvId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - BasePeer::TYPE_COLNAME => array (FeatureAvDescPeer::ID => 0, FeatureAvDescPeer::FEATURE_AV_ID => 1, FeatureAvDescPeer::LANG => 2, FeatureAvDescPeer::TITLE => 3, FeatureAvDescPeer::DESCRIPTION => 4, FeatureAvDescPeer::CHAPO => 5, FeatureAvDescPeer::CREATED_AT => 6, FeatureAvDescPeer::UPDATED_AT => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FEATURE_AV_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'feature_av_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'created_at' => 6, 'updated_at' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = FeatureAvDescPeer::getFieldNames($toType); - $key = isset(FeatureAvDescPeer::$fieldKeys[$fromType][$name]) ? FeatureAvDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(FeatureAvDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, FeatureAvDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return FeatureAvDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. FeatureAvDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(FeatureAvDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(FeatureAvDescPeer::ID); - $criteria->addSelectColumn(FeatureAvDescPeer::FEATURE_AV_ID); - $criteria->addSelectColumn(FeatureAvDescPeer::LANG); - $criteria->addSelectColumn(FeatureAvDescPeer::TITLE); - $criteria->addSelectColumn(FeatureAvDescPeer::DESCRIPTION); - $criteria->addSelectColumn(FeatureAvDescPeer::CHAPO); - $criteria->addSelectColumn(FeatureAvDescPeer::CREATED_AT); - $criteria->addSelectColumn(FeatureAvDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.FEATURE_AV_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(FeatureAvDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - FeatureAvDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(FeatureAvDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return FeatureAvDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = FeatureAvDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return FeatureAvDescPeer::populateObjects(FeatureAvDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - FeatureAvDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(FeatureAvDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param FeatureAvDesc $obj A FeatureAvDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - FeatureAvDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A FeatureAvDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof FeatureAvDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or FeatureAvDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(FeatureAvDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return FeatureAvDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(FeatureAvDescPeer::$instances[$key])) { - return FeatureAvDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - FeatureAvDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to feature_av_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = FeatureAvDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = FeatureAvDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = FeatureAvDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - FeatureAvDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (FeatureAvDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = FeatureAvDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = FeatureAvDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + FeatureAvDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = FeatureAvDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - FeatureAvDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related FeatureAv table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinFeatureAv(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(FeatureAvDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - FeatureAvDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(FeatureAvDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(FeatureAvDescPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of FeatureAvDesc objects pre-filled with their FeatureAv objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of FeatureAvDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinFeatureAv(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(FeatureAvDescPeer::DATABASE_NAME); - } - - FeatureAvDescPeer::addSelectColumns($criteria); - $startcol = FeatureAvDescPeer::NUM_HYDRATE_COLUMNS; - FeatureAvPeer::addSelectColumns($criteria); - - $criteria->addJoin(FeatureAvDescPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = FeatureAvDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = FeatureAvDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = FeatureAvDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - FeatureAvDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = FeatureAvPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = FeatureAvPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - FeatureAvPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (FeatureAvDesc) to $obj2 (FeatureAv) - $obj2->addFeatureAvDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(FeatureAvDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - FeatureAvDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(FeatureAvDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(FeatureAvDescPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of FeatureAvDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of FeatureAvDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(FeatureAvDescPeer::DATABASE_NAME); - } - - FeatureAvDescPeer::addSelectColumns($criteria); - $startcol2 = FeatureAvDescPeer::NUM_HYDRATE_COLUMNS; - - FeatureAvPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + FeatureAvPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(FeatureAvDescPeer::FEATURE_AV_ID, FeatureAvPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = FeatureAvDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = FeatureAvDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = FeatureAvDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - FeatureAvDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined FeatureAv rows - - $key2 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = FeatureAvPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = FeatureAvPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - FeatureAvPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (FeatureAvDesc) to the collection in $obj2 (FeatureAv) - $obj2->addFeatureAvDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(FeatureAvDescPeer::DATABASE_NAME)->getTable(FeatureAvDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseFeatureAvDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseFeatureAvDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new FeatureAvDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return FeatureAvDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a FeatureAvDesc or Criteria object. - * - * @param mixed $values Criteria or FeatureAvDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from FeatureAvDesc object - } - - if ($criteria->containsKey(FeatureAvDescPeer::ID) && $criteria->keyContainsValue(FeatureAvDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.FeatureAvDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(FeatureAvDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a FeatureAvDesc or Criteria object. - * - * @param mixed $values Criteria or FeatureAvDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(FeatureAvDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(FeatureAvDescPeer::ID); - $value = $criteria->remove(FeatureAvDescPeer::ID); - if ($value) { - $selectCriteria->add(FeatureAvDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(FeatureAvDescPeer::TABLE_NAME); - } - - } else { // $values is FeatureAvDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(FeatureAvDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the feature_av_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(FeatureAvDescPeer::TABLE_NAME, $con, FeatureAvDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - FeatureAvDescPeer::clearInstancePool(); - FeatureAvDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a FeatureAvDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or FeatureAvDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - FeatureAvDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof FeatureAvDesc) { // it's a model object - // invalidate the cache for this single object - FeatureAvDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(FeatureAvDescPeer::DATABASE_NAME); - $criteria->add(FeatureAvDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - FeatureAvDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(FeatureAvDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - FeatureAvDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given FeatureAvDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param FeatureAvDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(FeatureAvDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(FeatureAvDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(FeatureAvDescPeer::DATABASE_NAME, FeatureAvDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return FeatureAvDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = FeatureAvDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(FeatureAvDescPeer::DATABASE_NAME); - $criteria->add(FeatureAvDescPeer::ID, $pk); - - $v = FeatureAvDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return FeatureAvDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(FeatureAvDescPeer::DATABASE_NAME); - $criteria->add(FeatureAvDescPeer::ID, $pks, Criteria::IN); - $objs = FeatureAvDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseFeatureAvDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseFeatureAvDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseFeatureAvDescQuery.php b/core/lib/Thelia/Model/om/BaseFeatureAvDescQuery.php deleted file mode 100644 index dca3a0e9f..000000000 --- a/core/lib/Thelia/Model/om/BaseFeatureAvDescQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return FeatureAvDesc|FeatureAvDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = FeatureAvDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(FeatureAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return FeatureAvDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `FEATURE_AV_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `feature_av_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new FeatureAvDesc(); - $obj->hydrate($row); - FeatureAvDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return FeatureAvDesc|FeatureAvDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|FeatureAvDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(FeatureAvDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(FeatureAvDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(FeatureAvDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the feature_av_id column - * - * Example usage: - * - * $query->filterByFeatureAvId(1234); // WHERE feature_av_id = 1234 - * $query->filterByFeatureAvId(array(12, 34)); // WHERE feature_av_id IN (12, 34) - * $query->filterByFeatureAvId(array('min' => 12)); // WHERE feature_av_id > 12 - * - * - * @see filterByFeatureAv() - * - * @param mixed $featureAvId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function filterByFeatureAvId($featureAvId = null, $comparison = null) - { - if (is_array($featureAvId)) { - $useMinMax = false; - if (isset($featureAvId['min'])) { - $this->addUsingAlias(FeatureAvDescPeer::FEATURE_AV_ID, $featureAvId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($featureAvId['max'])) { - $this->addUsingAlias(FeatureAvDescPeer::FEATURE_AV_ID, $featureAvId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(FeatureAvDescPeer::FEATURE_AV_ID, $featureAvId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FeatureAvDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FeatureAvDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FeatureAvDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FeatureAvDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(FeatureAvDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(FeatureAvDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(FeatureAvDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(FeatureAvDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(FeatureAvDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(FeatureAvDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related FeatureAv object - * - * @param FeatureAv|PropelObjectCollection $featureAv The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureAvDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByFeatureAv($featureAv, $comparison = null) - { - if ($featureAv instanceof FeatureAv) { - return $this - ->addUsingAlias(FeatureAvDescPeer::FEATURE_AV_ID, $featureAv->getId(), $comparison); - } elseif ($featureAv instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(FeatureAvDescPeer::FEATURE_AV_ID, $featureAv->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByFeatureAv() only accepts arguments of type FeatureAv or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the FeatureAv relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function joinFeatureAv($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('FeatureAv'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'FeatureAv'); - } - - return $this; - } - - /** - * Use the FeatureAv relation FeatureAv object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\FeatureAvQuery A secondary query class using the current class as primary query - */ - public function useFeatureAvQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinFeatureAv($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'FeatureAv', '\Thelia\Model\FeatureAvQuery'); - } - - /** - * Exclude object from result - * - * @param FeatureAvDesc $featureAvDesc Object to remove from the list of results - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function prune($featureAvDesc = null) - { - if ($featureAvDesc) { - $this->addUsingAlias(FeatureAvDescPeer::ID, $featureAvDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(FeatureAvDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(FeatureAvDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(FeatureAvDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(FeatureAvDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(FeatureAvDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return FeatureAvDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(FeatureAvDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseFeatureDesc.php b/core/lib/Thelia/Model/om/BaseFeatureDesc.php deleted file mode 100644 index 9581d2214..000000000 --- a/core/lib/Thelia/Model/om/BaseFeatureDesc.php +++ /dev/null @@ -1,1345 +0,0 @@ -id; - } - - /** - * Get the [feature_id] column value. - * - * @return int - */ - public function getFeatureId() - { - return $this->feature_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return FeatureDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = FeatureDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [feature_id] column. - * - * @param int $v new value - * @return FeatureDesc The current object (for fluent API support) - */ - public function setFeatureId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->feature_id !== $v) { - $this->feature_id = $v; - $this->modifiedColumns[] = FeatureDescPeer::FEATURE_ID; - } - - if ($this->aFeature !== null && $this->aFeature->getId() !== $v) { - $this->aFeature = null; - } - - - return $this; - } // setFeatureId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return FeatureDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = FeatureDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return FeatureDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = FeatureDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return FeatureDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = FeatureDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return FeatureDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = FeatureDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return FeatureDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = FeatureDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return FeatureDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = FeatureDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->feature_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->updated_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = FeatureDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating FeatureDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aFeature !== null && $this->feature_id !== $this->aFeature->getId()) { - $this->aFeature = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = FeatureDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aFeature = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = FeatureDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(FeatureDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(FeatureDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(FeatureDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - FeatureDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aFeature !== null) { - if ($this->aFeature->isModified() || $this->aFeature->isNew()) { - $affectedRows += $this->aFeature->save($con); - } - $this->setFeature($this->aFeature); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = FeatureDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . FeatureDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(FeatureDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(FeatureDescPeer::FEATURE_ID)) { - $modifiedColumns[':p' . $index++] = '`FEATURE_ID`'; - } - if ($this->isColumnModified(FeatureDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(FeatureDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(FeatureDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(FeatureDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(FeatureDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(FeatureDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `feature_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`FEATURE_ID`': - $stmt->bindValue($identifier, $this->feature_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aFeature !== null) { - if (!$this->aFeature->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aFeature->getValidationFailures()); - } - } - - - if (($retval = FeatureDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = FeatureDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getFeatureId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['FeatureDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['FeatureDesc'][$this->getPrimaryKey()] = true; - $keys = FeatureDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getFeatureId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aFeature) { - $result['Feature'] = $this->aFeature->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = FeatureDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setFeatureId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = FeatureDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setFeatureId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(FeatureDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(FeatureDescPeer::ID)) $criteria->add(FeatureDescPeer::ID, $this->id); - if ($this->isColumnModified(FeatureDescPeer::FEATURE_ID)) $criteria->add(FeatureDescPeer::FEATURE_ID, $this->feature_id); - if ($this->isColumnModified(FeatureDescPeer::LANG)) $criteria->add(FeatureDescPeer::LANG, $this->lang); - if ($this->isColumnModified(FeatureDescPeer::TITLE)) $criteria->add(FeatureDescPeer::TITLE, $this->title); - if ($this->isColumnModified(FeatureDescPeer::DESCRIPTION)) $criteria->add(FeatureDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(FeatureDescPeer::CHAPO)) $criteria->add(FeatureDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(FeatureDescPeer::CREATED_AT)) $criteria->add(FeatureDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(FeatureDescPeer::UPDATED_AT)) $criteria->add(FeatureDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(FeatureDescPeer::DATABASE_NAME); - $criteria->add(FeatureDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of FeatureDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setFeatureId($this->getFeatureId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return FeatureDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return FeatureDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new FeatureDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Feature object. - * - * @param Feature $v - * @return FeatureDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setFeature(Feature $v = null) - { - if ($v === null) { - $this->setFeatureId(NULL); - } else { - $this->setFeatureId($v->getId()); - } - - $this->aFeature = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Feature object, it will not be re-added. - if ($v !== null) { - $v->addFeatureDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Feature object - * - * @param PropelPDO $con Optional Connection object. - * @return Feature The associated Feature object. - * @throws PropelException - */ - public function getFeature(PropelPDO $con = null) - { - if ($this->aFeature === null && ($this->feature_id !== null)) { - $this->aFeature = FeatureQuery::create()->findPk($this->feature_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aFeature->addFeatureDescs($this); - */ - } - - return $this->aFeature; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->feature_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aFeature = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(FeatureDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return FeatureDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = FeatureDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseFeatureDescPeer.php b/core/lib/Thelia/Model/om/BaseFeatureDescPeer.php deleted file mode 100644 index 1557012c2..000000000 --- a/core/lib/Thelia/Model/om/BaseFeatureDescPeer.php +++ /dev/null @@ -1,1037 +0,0 @@ - array ('Id', 'FeatureId', 'Lang', 'Title', 'Description', 'Chapo', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'featureId', 'lang', 'title', 'description', 'chapo', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (FeatureDescPeer::ID, FeatureDescPeer::FEATURE_ID, FeatureDescPeer::LANG, FeatureDescPeer::TITLE, FeatureDescPeer::DESCRIPTION, FeatureDescPeer::CHAPO, FeatureDescPeer::CREATED_AT, FeatureDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FEATURE_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'feature_id', 'lang', 'title', 'description', 'chapo', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. FeatureDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FeatureId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'featureId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - BasePeer::TYPE_COLNAME => array (FeatureDescPeer::ID => 0, FeatureDescPeer::FEATURE_ID => 1, FeatureDescPeer::LANG => 2, FeatureDescPeer::TITLE => 3, FeatureDescPeer::DESCRIPTION => 4, FeatureDescPeer::CHAPO => 5, FeatureDescPeer::CREATED_AT => 6, FeatureDescPeer::UPDATED_AT => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FEATURE_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'feature_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'created_at' => 6, 'updated_at' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = FeatureDescPeer::getFieldNames($toType); - $key = isset(FeatureDescPeer::$fieldKeys[$fromType][$name]) ? FeatureDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(FeatureDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, FeatureDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return FeatureDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. FeatureDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(FeatureDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(FeatureDescPeer::ID); - $criteria->addSelectColumn(FeatureDescPeer::FEATURE_ID); - $criteria->addSelectColumn(FeatureDescPeer::LANG); - $criteria->addSelectColumn(FeatureDescPeer::TITLE); - $criteria->addSelectColumn(FeatureDescPeer::DESCRIPTION); - $criteria->addSelectColumn(FeatureDescPeer::CHAPO); - $criteria->addSelectColumn(FeatureDescPeer::CREATED_AT); - $criteria->addSelectColumn(FeatureDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.FEATURE_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(FeatureDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - FeatureDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(FeatureDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return FeatureDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = FeatureDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return FeatureDescPeer::populateObjects(FeatureDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - FeatureDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(FeatureDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param FeatureDesc $obj A FeatureDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - FeatureDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A FeatureDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof FeatureDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or FeatureDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(FeatureDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return FeatureDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(FeatureDescPeer::$instances[$key])) { - return FeatureDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - FeatureDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to feature_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = FeatureDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = FeatureDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = FeatureDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - FeatureDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (FeatureDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = FeatureDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = FeatureDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + FeatureDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = FeatureDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - FeatureDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Feature table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinFeature(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(FeatureDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - FeatureDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(FeatureDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(FeatureDescPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of FeatureDesc objects pre-filled with their Feature objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of FeatureDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinFeature(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(FeatureDescPeer::DATABASE_NAME); - } - - FeatureDescPeer::addSelectColumns($criteria); - $startcol = FeatureDescPeer::NUM_HYDRATE_COLUMNS; - FeaturePeer::addSelectColumns($criteria); - - $criteria->addJoin(FeatureDescPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = FeatureDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = FeatureDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = FeatureDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - FeatureDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = FeaturePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = FeaturePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - FeaturePeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (FeatureDesc) to $obj2 (Feature) - $obj2->addFeatureDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(FeatureDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - FeatureDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(FeatureDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(FeatureDescPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of FeatureDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of FeatureDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(FeatureDescPeer::DATABASE_NAME); - } - - FeatureDescPeer::addSelectColumns($criteria); - $startcol2 = FeatureDescPeer::NUM_HYDRATE_COLUMNS; - - FeaturePeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + FeaturePeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(FeatureDescPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = FeatureDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = FeatureDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = FeatureDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - FeatureDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Feature rows - - $key2 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = FeaturePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = FeaturePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - FeaturePeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (FeatureDesc) to the collection in $obj2 (Feature) - $obj2->addFeatureDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(FeatureDescPeer::DATABASE_NAME)->getTable(FeatureDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseFeatureDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseFeatureDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new FeatureDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return FeatureDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a FeatureDesc or Criteria object. - * - * @param mixed $values Criteria or FeatureDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from FeatureDesc object - } - - if ($criteria->containsKey(FeatureDescPeer::ID) && $criteria->keyContainsValue(FeatureDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.FeatureDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(FeatureDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a FeatureDesc or Criteria object. - * - * @param mixed $values Criteria or FeatureDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(FeatureDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(FeatureDescPeer::ID); - $value = $criteria->remove(FeatureDescPeer::ID); - if ($value) { - $selectCriteria->add(FeatureDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(FeatureDescPeer::TABLE_NAME); - } - - } else { // $values is FeatureDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(FeatureDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the feature_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(FeatureDescPeer::TABLE_NAME, $con, FeatureDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - FeatureDescPeer::clearInstancePool(); - FeatureDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a FeatureDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or FeatureDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - FeatureDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof FeatureDesc) { // it's a model object - // invalidate the cache for this single object - FeatureDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(FeatureDescPeer::DATABASE_NAME); - $criteria->add(FeatureDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - FeatureDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(FeatureDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - FeatureDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given FeatureDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param FeatureDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(FeatureDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(FeatureDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(FeatureDescPeer::DATABASE_NAME, FeatureDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return FeatureDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = FeatureDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(FeatureDescPeer::DATABASE_NAME); - $criteria->add(FeatureDescPeer::ID, $pk); - - $v = FeatureDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return FeatureDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(FeatureDescPeer::DATABASE_NAME); - $criteria->add(FeatureDescPeer::ID, $pks, Criteria::IN); - $objs = FeatureDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseFeatureDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseFeatureDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseFeatureDescQuery.php b/core/lib/Thelia/Model/om/BaseFeatureDescQuery.php deleted file mode 100644 index 9d1f956b8..000000000 --- a/core/lib/Thelia/Model/om/BaseFeatureDescQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return FeatureDesc|FeatureDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = FeatureDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(FeatureDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return FeatureDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `FEATURE_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `feature_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new FeatureDesc(); - $obj->hydrate($row); - FeatureDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return FeatureDesc|FeatureDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|FeatureDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(FeatureDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(FeatureDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(FeatureDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the feature_id column - * - * Example usage: - * - * $query->filterByFeatureId(1234); // WHERE feature_id = 1234 - * $query->filterByFeatureId(array(12, 34)); // WHERE feature_id IN (12, 34) - * $query->filterByFeatureId(array('min' => 12)); // WHERE feature_id > 12 - * - * - * @see filterByFeature() - * - * @param mixed $featureId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function filterByFeatureId($featureId = null, $comparison = null) - { - if (is_array($featureId)) { - $useMinMax = false; - if (isset($featureId['min'])) { - $this->addUsingAlias(FeatureDescPeer::FEATURE_ID, $featureId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($featureId['max'])) { - $this->addUsingAlias(FeatureDescPeer::FEATURE_ID, $featureId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(FeatureDescPeer::FEATURE_ID, $featureId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FeatureDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FeatureDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FeatureDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FeatureDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(FeatureDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(FeatureDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(FeatureDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(FeatureDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(FeatureDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(FeatureDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Feature object - * - * @param Feature|PropelObjectCollection $feature The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FeatureDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByFeature($feature, $comparison = null) - { - if ($feature instanceof Feature) { - return $this - ->addUsingAlias(FeatureDescPeer::FEATURE_ID, $feature->getId(), $comparison); - } elseif ($feature instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(FeatureDescPeer::FEATURE_ID, $feature->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByFeature() only accepts arguments of type Feature or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Feature relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function joinFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Feature'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Feature'); - } - - return $this; - } - - /** - * Use the Feature relation Feature object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\FeatureQuery A secondary query class using the current class as primary query - */ - public function useFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinFeature($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Feature', '\Thelia\Model\FeatureQuery'); - } - - /** - * Exclude object from result - * - * @param FeatureDesc $featureDesc Object to remove from the list of results - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function prune($featureDesc = null) - { - if ($featureDesc) { - $this->addUsingAlias(FeatureDescPeer::ID, $featureDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(FeatureDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(FeatureDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(FeatureDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(FeatureDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(FeatureDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return FeatureDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(FeatureDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseFolderDesc.php b/core/lib/Thelia/Model/om/BaseFolderDesc.php deleted file mode 100644 index e5d247e8d..000000000 --- a/core/lib/Thelia/Model/om/BaseFolderDesc.php +++ /dev/null @@ -1,1400 +0,0 @@ -id; - } - - /** - * Get the [folder_id] column value. - * - * @return int - */ - public function getFolderId() - { - return $this->folder_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [postscriptum] column value. - * - * @return string - */ - public function getPostscriptum() - { - return $this->postscriptum; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return FolderDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = FolderDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [folder_id] column. - * - * @param int $v new value - * @return FolderDesc The current object (for fluent API support) - */ - public function setFolderId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->folder_id !== $v) { - $this->folder_id = $v; - $this->modifiedColumns[] = FolderDescPeer::FOLDER_ID; - } - - if ($this->aFolder !== null && $this->aFolder->getId() !== $v) { - $this->aFolder = null; - } - - - return $this; - } // setFolderId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return FolderDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = FolderDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return FolderDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = FolderDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return FolderDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = FolderDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return FolderDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = FolderDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Set the value of [postscriptum] column. - * - * @param string $v new value - * @return FolderDesc The current object (for fluent API support) - */ - public function setPostscriptum($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->postscriptum !== $v) { - $this->postscriptum = $v; - $this->modifiedColumns[] = FolderDescPeer::POSTSCRIPTUM; - } - - - return $this; - } // setPostscriptum() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return FolderDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = FolderDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return FolderDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = FolderDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->folder_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->postscriptum = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->created_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->updated_at = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 9; // 9 = FolderDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating FolderDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aFolder !== null && $this->folder_id !== $this->aFolder->getId()) { - $this->aFolder = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = FolderDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aFolder = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = FolderDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(FolderDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(FolderDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(FolderDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - FolderDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aFolder !== null) { - if ($this->aFolder->isModified() || $this->aFolder->isNew()) { - $affectedRows += $this->aFolder->save($con); - } - $this->setFolder($this->aFolder); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = FolderDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . FolderDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(FolderDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(FolderDescPeer::FOLDER_ID)) { - $modifiedColumns[':p' . $index++] = '`FOLDER_ID`'; - } - if ($this->isColumnModified(FolderDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(FolderDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(FolderDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(FolderDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(FolderDescPeer::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; - } - if ($this->isColumnModified(FolderDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(FolderDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `folder_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`FOLDER_ID`': - $stmt->bindValue($identifier, $this->folder_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`POSTSCRIPTUM`': - $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aFolder !== null) { - if (!$this->aFolder->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aFolder->getValidationFailures()); - } - } - - - if (($retval = FolderDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = FolderDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getFolderId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getPostscriptum(); - break; - case 7: - return $this->getCreatedAt(); - break; - case 8: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['FolderDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['FolderDesc'][$this->getPrimaryKey()] = true; - $keys = FolderDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getFolderId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getPostscriptum(), - $keys[7] => $this->getCreatedAt(), - $keys[8] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aFolder) { - $result['Folder'] = $this->aFolder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = FolderDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setFolderId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setPostscriptum($value); - break; - case 7: - $this->setCreatedAt($value); - break; - case 8: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = FolderDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setFolderId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setPostscriptum($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(FolderDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(FolderDescPeer::ID)) $criteria->add(FolderDescPeer::ID, $this->id); - if ($this->isColumnModified(FolderDescPeer::FOLDER_ID)) $criteria->add(FolderDescPeer::FOLDER_ID, $this->folder_id); - if ($this->isColumnModified(FolderDescPeer::LANG)) $criteria->add(FolderDescPeer::LANG, $this->lang); - if ($this->isColumnModified(FolderDescPeer::TITLE)) $criteria->add(FolderDescPeer::TITLE, $this->title); - if ($this->isColumnModified(FolderDescPeer::DESCRIPTION)) $criteria->add(FolderDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(FolderDescPeer::CHAPO)) $criteria->add(FolderDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(FolderDescPeer::POSTSCRIPTUM)) $criteria->add(FolderDescPeer::POSTSCRIPTUM, $this->postscriptum); - if ($this->isColumnModified(FolderDescPeer::CREATED_AT)) $criteria->add(FolderDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(FolderDescPeer::UPDATED_AT)) $criteria->add(FolderDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(FolderDescPeer::DATABASE_NAME); - $criteria->add(FolderDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of FolderDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setFolderId($this->getFolderId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setPostscriptum($this->getPostscriptum()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return FolderDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return FolderDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new FolderDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Folder object. - * - * @param Folder $v - * @return FolderDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setFolder(Folder $v = null) - { - if ($v === null) { - $this->setFolderId(NULL); - } else { - $this->setFolderId($v->getId()); - } - - $this->aFolder = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Folder object, it will not be re-added. - if ($v !== null) { - $v->addFolderDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Folder object - * - * @param PropelPDO $con Optional Connection object. - * @return Folder The associated Folder object. - * @throws PropelException - */ - public function getFolder(PropelPDO $con = null) - { - if ($this->aFolder === null && ($this->folder_id !== null)) { - $this->aFolder = FolderQuery::create()->findPk($this->folder_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aFolder->addFolderDescs($this); - */ - } - - return $this->aFolder; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->folder_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->postscriptum = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aFolder = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(FolderDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return FolderDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = FolderDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseFolderDescPeer.php b/core/lib/Thelia/Model/om/BaseFolderDescPeer.php deleted file mode 100644 index 92d614047..000000000 --- a/core/lib/Thelia/Model/om/BaseFolderDescPeer.php +++ /dev/null @@ -1,1042 +0,0 @@ - array ('Id', 'FolderId', 'Lang', 'Title', 'Description', 'Chapo', 'Postscriptum', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'folderId', 'lang', 'title', 'description', 'chapo', 'postscriptum', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (FolderDescPeer::ID, FolderDescPeer::FOLDER_ID, FolderDescPeer::LANG, FolderDescPeer::TITLE, FolderDescPeer::DESCRIPTION, FolderDescPeer::CHAPO, FolderDescPeer::POSTSCRIPTUM, FolderDescPeer::CREATED_AT, FolderDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FOLDER_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'folder_id', 'lang', 'title', 'description', 'chapo', 'postscriptum', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. FolderDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FolderId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'Postscriptum' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'folderId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'postscriptum' => 6, 'createdAt' => 7, 'updatedAt' => 8, ), - BasePeer::TYPE_COLNAME => array (FolderDescPeer::ID => 0, FolderDescPeer::FOLDER_ID => 1, FolderDescPeer::LANG => 2, FolderDescPeer::TITLE => 3, FolderDescPeer::DESCRIPTION => 4, FolderDescPeer::CHAPO => 5, FolderDescPeer::POSTSCRIPTUM => 6, FolderDescPeer::CREATED_AT => 7, FolderDescPeer::UPDATED_AT => 8, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FOLDER_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'POSTSCRIPTUM' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'folder_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'postscriptum' => 6, 'created_at' => 7, 'updated_at' => 8, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = FolderDescPeer::getFieldNames($toType); - $key = isset(FolderDescPeer::$fieldKeys[$fromType][$name]) ? FolderDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(FolderDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, FolderDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return FolderDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. FolderDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(FolderDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(FolderDescPeer::ID); - $criteria->addSelectColumn(FolderDescPeer::FOLDER_ID); - $criteria->addSelectColumn(FolderDescPeer::LANG); - $criteria->addSelectColumn(FolderDescPeer::TITLE); - $criteria->addSelectColumn(FolderDescPeer::DESCRIPTION); - $criteria->addSelectColumn(FolderDescPeer::CHAPO); - $criteria->addSelectColumn(FolderDescPeer::POSTSCRIPTUM); - $criteria->addSelectColumn(FolderDescPeer::CREATED_AT); - $criteria->addSelectColumn(FolderDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.FOLDER_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.POSTSCRIPTUM'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(FolderDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - FolderDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(FolderDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return FolderDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = FolderDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return FolderDescPeer::populateObjects(FolderDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - FolderDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(FolderDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param FolderDesc $obj A FolderDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - FolderDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A FolderDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof FolderDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or FolderDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(FolderDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return FolderDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(FolderDescPeer::$instances[$key])) { - return FolderDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - FolderDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to folder_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = FolderDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = FolderDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = FolderDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - FolderDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (FolderDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = FolderDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = FolderDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + FolderDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = FolderDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - FolderDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Folder table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinFolder(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(FolderDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - FolderDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(FolderDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(FolderDescPeer::FOLDER_ID, FolderPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of FolderDesc objects pre-filled with their Folder objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of FolderDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinFolder(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(FolderDescPeer::DATABASE_NAME); - } - - FolderDescPeer::addSelectColumns($criteria); - $startcol = FolderDescPeer::NUM_HYDRATE_COLUMNS; - FolderPeer::addSelectColumns($criteria); - - $criteria->addJoin(FolderDescPeer::FOLDER_ID, FolderPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = FolderDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = FolderDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = FolderDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - FolderDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = FolderPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = FolderPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = FolderPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - FolderPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (FolderDesc) to $obj2 (Folder) - $obj2->addFolderDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(FolderDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - FolderDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(FolderDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(FolderDescPeer::FOLDER_ID, FolderPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of FolderDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of FolderDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(FolderDescPeer::DATABASE_NAME); - } - - FolderDescPeer::addSelectColumns($criteria); - $startcol2 = FolderDescPeer::NUM_HYDRATE_COLUMNS; - - FolderPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + FolderPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(FolderDescPeer::FOLDER_ID, FolderPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = FolderDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = FolderDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = FolderDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - FolderDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Folder rows - - $key2 = FolderPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = FolderPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = FolderPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - FolderPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (FolderDesc) to the collection in $obj2 (Folder) - $obj2->addFolderDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(FolderDescPeer::DATABASE_NAME)->getTable(FolderDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseFolderDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseFolderDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new FolderDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return FolderDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a FolderDesc or Criteria object. - * - * @param mixed $values Criteria or FolderDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from FolderDesc object - } - - if ($criteria->containsKey(FolderDescPeer::ID) && $criteria->keyContainsValue(FolderDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.FolderDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(FolderDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a FolderDesc or Criteria object. - * - * @param mixed $values Criteria or FolderDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(FolderDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(FolderDescPeer::ID); - $value = $criteria->remove(FolderDescPeer::ID); - if ($value) { - $selectCriteria->add(FolderDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(FolderDescPeer::TABLE_NAME); - } - - } else { // $values is FolderDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(FolderDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the folder_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(FolderDescPeer::TABLE_NAME, $con, FolderDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - FolderDescPeer::clearInstancePool(); - FolderDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a FolderDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or FolderDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - FolderDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof FolderDesc) { // it's a model object - // invalidate the cache for this single object - FolderDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(FolderDescPeer::DATABASE_NAME); - $criteria->add(FolderDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - FolderDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(FolderDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - FolderDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given FolderDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param FolderDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(FolderDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(FolderDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(FolderDescPeer::DATABASE_NAME, FolderDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return FolderDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = FolderDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(FolderDescPeer::DATABASE_NAME); - $criteria->add(FolderDescPeer::ID, $pk); - - $v = FolderDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return FolderDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(FolderDescPeer::DATABASE_NAME); - $criteria->add(FolderDescPeer::ID, $pks, Criteria::IN); - $objs = FolderDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseFolderDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseFolderDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseFolderDescQuery.php b/core/lib/Thelia/Model/om/BaseFolderDescQuery.php deleted file mode 100644 index f7af60c28..000000000 --- a/core/lib/Thelia/Model/om/BaseFolderDescQuery.php +++ /dev/null @@ -1,711 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return FolderDesc|FolderDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = FolderDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(FolderDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return FolderDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `FOLDER_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `CREATED_AT`, `UPDATED_AT` FROM `folder_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new FolderDesc(); - $obj->hydrate($row); - FolderDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return FolderDesc|FolderDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|FolderDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(FolderDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(FolderDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(FolderDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the folder_id column - * - * Example usage: - * - * $query->filterByFolderId(1234); // WHERE folder_id = 1234 - * $query->filterByFolderId(array(12, 34)); // WHERE folder_id IN (12, 34) - * $query->filterByFolderId(array('min' => 12)); // WHERE folder_id > 12 - * - * - * @see filterByFolder() - * - * @param mixed $folderId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterByFolderId($folderId = null, $comparison = null) - { - if (is_array($folderId)) { - $useMinMax = false; - if (isset($folderId['min'])) { - $this->addUsingAlias(FolderDescPeer::FOLDER_ID, $folderId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($folderId['max'])) { - $this->addUsingAlias(FolderDescPeer::FOLDER_ID, $folderId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(FolderDescPeer::FOLDER_ID, $folderId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FolderDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FolderDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FolderDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FolderDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the postscriptum column - * - * Example usage: - * - * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue' - * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%' - * - * - * @param string $postscriptum The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterByPostscriptum($postscriptum = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($postscriptum)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $postscriptum)) { - $postscriptum = str_replace('*', '%', $postscriptum); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(FolderDescPeer::POSTSCRIPTUM, $postscriptum, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(FolderDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(FolderDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(FolderDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(FolderDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(FolderDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(FolderDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Folder object - * - * @param Folder|PropelObjectCollection $folder The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return FolderDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByFolder($folder, $comparison = null) - { - if ($folder instanceof Folder) { - return $this - ->addUsingAlias(FolderDescPeer::FOLDER_ID, $folder->getId(), $comparison); - } elseif ($folder instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(FolderDescPeer::FOLDER_ID, $folder->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByFolder() only accepts arguments of type Folder or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Folder relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function joinFolder($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Folder'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Folder'); - } - - return $this; - } - - /** - * Use the Folder relation Folder object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\FolderQuery A secondary query class using the current class as primary query - */ - public function useFolderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinFolder($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Folder', '\Thelia\Model\FolderQuery'); - } - - /** - * Exclude object from result - * - * @param FolderDesc $folderDesc Object to remove from the list of results - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function prune($folderDesc = null) - { - if ($folderDesc) { - $this->addUsingAlias(FolderDescPeer::ID, $folderDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(FolderDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(FolderDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(FolderDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(FolderDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(FolderDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return FolderDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(FolderDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseGroupDesc.php b/core/lib/Thelia/Model/om/BaseGroupDesc.php deleted file mode 100644 index e59ad6f58..000000000 --- a/core/lib/Thelia/Model/om/BaseGroupDesc.php +++ /dev/null @@ -1,1334 +0,0 @@ -id; - } - - /** - * Get the [group_id] column value. - * - * @return int - */ - public function getGroupId() - { - return $this->group_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return GroupDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = GroupDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [group_id] column. - * - * @param int $v new value - * @return GroupDesc The current object (for fluent API support) - */ - public function setGroupId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->group_id !== $v) { - $this->group_id = $v; - $this->modifiedColumns[] = GroupDescPeer::GROUP_ID; - } - - if ($this->aGroup !== null && $this->aGroup->getId() !== $v) { - $this->aGroup = null; - } - - - return $this; - } // setGroupId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return GroupDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = GroupDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return GroupDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = GroupDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return GroupDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = GroupDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return GroupDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = GroupDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return GroupDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = GroupDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return GroupDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = GroupDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->group_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->updated_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = GroupDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating GroupDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aGroup !== null && $this->group_id !== $this->aGroup->getId()) { - $this->aGroup = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = GroupDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aGroup = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = GroupDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(GroupDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(GroupDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(GroupDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - GroupDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aGroup !== null) { - if ($this->aGroup->isModified() || $this->aGroup->isNew()) { - $affectedRows += $this->aGroup->save($con); - } - $this->setGroup($this->aGroup); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(GroupDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(GroupDescPeer::GROUP_ID)) { - $modifiedColumns[':p' . $index++] = '`GROUP_ID`'; - } - if ($this->isColumnModified(GroupDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(GroupDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(GroupDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(GroupDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(GroupDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(GroupDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `group_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`GROUP_ID`': - $stmt->bindValue($identifier, $this->group_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aGroup !== null) { - if (!$this->aGroup->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aGroup->getValidationFailures()); - } - } - - - if (($retval = GroupDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = GroupDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getGroupId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['GroupDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['GroupDesc'][$this->getPrimaryKey()] = true; - $keys = GroupDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getGroupId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aGroup) { - $result['Group'] = $this->aGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = GroupDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setGroupId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = GroupDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setGroupId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(GroupDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(GroupDescPeer::ID)) $criteria->add(GroupDescPeer::ID, $this->id); - if ($this->isColumnModified(GroupDescPeer::GROUP_ID)) $criteria->add(GroupDescPeer::GROUP_ID, $this->group_id); - if ($this->isColumnModified(GroupDescPeer::LANG)) $criteria->add(GroupDescPeer::LANG, $this->lang); - if ($this->isColumnModified(GroupDescPeer::TITLE)) $criteria->add(GroupDescPeer::TITLE, $this->title); - if ($this->isColumnModified(GroupDescPeer::DESCRIPTION)) $criteria->add(GroupDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(GroupDescPeer::CHAPO)) $criteria->add(GroupDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(GroupDescPeer::CREATED_AT)) $criteria->add(GroupDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(GroupDescPeer::UPDATED_AT)) $criteria->add(GroupDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(GroupDescPeer::DATABASE_NAME); - $criteria->add(GroupDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of GroupDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setGroupId($this->getGroupId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return GroupDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return GroupDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new GroupDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Group object. - * - * @param Group $v - * @return GroupDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setGroup(Group $v = null) - { - if ($v === null) { - $this->setGroupId(NULL); - } else { - $this->setGroupId($v->getId()); - } - - $this->aGroup = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Group object, it will not be re-added. - if ($v !== null) { - $v->addGroupDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Group object - * - * @param PropelPDO $con Optional Connection object. - * @return Group The associated Group object. - * @throws PropelException - */ - public function getGroup(PropelPDO $con = null) - { - if ($this->aGroup === null && ($this->group_id !== null)) { - $this->aGroup = GroupQuery::create()->findPk($this->group_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aGroup->addGroupDescs($this); - */ - } - - return $this->aGroup; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->group_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aGroup = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(GroupDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return GroupDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = GroupDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseGroupDescPeer.php b/core/lib/Thelia/Model/om/BaseGroupDescPeer.php deleted file mode 100644 index 968d5789c..000000000 --- a/core/lib/Thelia/Model/om/BaseGroupDescPeer.php +++ /dev/null @@ -1,1033 +0,0 @@ - array ('Id', 'GroupId', 'Lang', 'Title', 'Description', 'Chapo', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'groupId', 'lang', 'title', 'description', 'chapo', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (GroupDescPeer::ID, GroupDescPeer::GROUP_ID, GroupDescPeer::LANG, GroupDescPeer::TITLE, GroupDescPeer::DESCRIPTION, GroupDescPeer::CHAPO, GroupDescPeer::CREATED_AT, GroupDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'GROUP_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'group_id', 'lang', 'title', 'description', 'chapo', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. GroupDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'GroupId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'groupId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - BasePeer::TYPE_COLNAME => array (GroupDescPeer::ID => 0, GroupDescPeer::GROUP_ID => 1, GroupDescPeer::LANG => 2, GroupDescPeer::TITLE => 3, GroupDescPeer::DESCRIPTION => 4, GroupDescPeer::CHAPO => 5, GroupDescPeer::CREATED_AT => 6, GroupDescPeer::UPDATED_AT => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'GROUP_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'group_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'created_at' => 6, 'updated_at' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = GroupDescPeer::getFieldNames($toType); - $key = isset(GroupDescPeer::$fieldKeys[$fromType][$name]) ? GroupDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(GroupDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, GroupDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return GroupDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. GroupDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(GroupDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(GroupDescPeer::ID); - $criteria->addSelectColumn(GroupDescPeer::GROUP_ID); - $criteria->addSelectColumn(GroupDescPeer::LANG); - $criteria->addSelectColumn(GroupDescPeer::TITLE); - $criteria->addSelectColumn(GroupDescPeer::DESCRIPTION); - $criteria->addSelectColumn(GroupDescPeer::CHAPO); - $criteria->addSelectColumn(GroupDescPeer::CREATED_AT); - $criteria->addSelectColumn(GroupDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.GROUP_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(GroupDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - GroupDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(GroupDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return GroupDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = GroupDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return GroupDescPeer::populateObjects(GroupDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - GroupDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(GroupDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param GroupDesc $obj A GroupDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - GroupDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A GroupDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof GroupDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or GroupDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(GroupDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return GroupDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(GroupDescPeer::$instances[$key])) { - return GroupDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - GroupDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to group_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = GroupDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = GroupDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = GroupDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - GroupDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (GroupDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = GroupDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = GroupDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + GroupDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = GroupDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - GroupDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Group table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(GroupDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - GroupDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(GroupDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(GroupDescPeer::GROUP_ID, GroupPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of GroupDesc objects pre-filled with their Group objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of GroupDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinGroup(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(GroupDescPeer::DATABASE_NAME); - } - - GroupDescPeer::addSelectColumns($criteria); - $startcol = GroupDescPeer::NUM_HYDRATE_COLUMNS; - GroupPeer::addSelectColumns($criteria); - - $criteria->addJoin(GroupDescPeer::GROUP_ID, GroupPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = GroupDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = GroupDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = GroupDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - GroupDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = GroupPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = GroupPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = GroupPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - GroupPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (GroupDesc) to $obj2 (Group) - $obj2->addGroupDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(GroupDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - GroupDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(GroupDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(GroupDescPeer::GROUP_ID, GroupPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of GroupDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of GroupDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(GroupDescPeer::DATABASE_NAME); - } - - GroupDescPeer::addSelectColumns($criteria); - $startcol2 = GroupDescPeer::NUM_HYDRATE_COLUMNS; - - GroupPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + GroupPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(GroupDescPeer::GROUP_ID, GroupPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = GroupDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = GroupDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = GroupDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - GroupDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Group rows - - $key2 = GroupPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = GroupPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = GroupPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - GroupPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (GroupDesc) to the collection in $obj2 (Group) - $obj2->addGroupDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(GroupDescPeer::DATABASE_NAME)->getTable(GroupDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseGroupDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseGroupDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new GroupDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return GroupDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a GroupDesc or Criteria object. - * - * @param mixed $values Criteria or GroupDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from GroupDesc object - } - - - // Set the correct dbName - $criteria->setDbName(GroupDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a GroupDesc or Criteria object. - * - * @param mixed $values Criteria or GroupDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(GroupDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(GroupDescPeer::ID); - $value = $criteria->remove(GroupDescPeer::ID); - if ($value) { - $selectCriteria->add(GroupDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(GroupDescPeer::TABLE_NAME); - } - - } else { // $values is GroupDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(GroupDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the group_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(GroupDescPeer::TABLE_NAME, $con, GroupDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - GroupDescPeer::clearInstancePool(); - GroupDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a GroupDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or GroupDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - GroupDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof GroupDesc) { // it's a model object - // invalidate the cache for this single object - GroupDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(GroupDescPeer::DATABASE_NAME); - $criteria->add(GroupDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - GroupDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(GroupDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - GroupDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given GroupDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param GroupDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(GroupDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(GroupDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(GroupDescPeer::DATABASE_NAME, GroupDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return GroupDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = GroupDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(GroupDescPeer::DATABASE_NAME); - $criteria->add(GroupDescPeer::ID, $pk); - - $v = GroupDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return GroupDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(GroupDescPeer::DATABASE_NAME); - $criteria->add(GroupDescPeer::ID, $pks, Criteria::IN); - $objs = GroupDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseGroupDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseGroupDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseGroupDescQuery.php b/core/lib/Thelia/Model/om/BaseGroupDescQuery.php deleted file mode 100644 index 72dae3934..000000000 --- a/core/lib/Thelia/Model/om/BaseGroupDescQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return GroupDesc|GroupDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = GroupDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(GroupDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return GroupDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `GROUP_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `group_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new GroupDesc(); - $obj->hydrate($row); - GroupDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return GroupDesc|GroupDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|GroupDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(GroupDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(GroupDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(GroupDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the group_id column - * - * Example usage: - * - * $query->filterByGroupId(1234); // WHERE group_id = 1234 - * $query->filterByGroupId(array(12, 34)); // WHERE group_id IN (12, 34) - * $query->filterByGroupId(array('min' => 12)); // WHERE group_id > 12 - * - * - * @see filterByGroup() - * - * @param mixed $groupId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function filterByGroupId($groupId = null, $comparison = null) - { - if (is_array($groupId)) { - $useMinMax = false; - if (isset($groupId['min'])) { - $this->addUsingAlias(GroupDescPeer::GROUP_ID, $groupId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($groupId['max'])) { - $this->addUsingAlias(GroupDescPeer::GROUP_ID, $groupId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(GroupDescPeer::GROUP_ID, $groupId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(GroupDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(GroupDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(GroupDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(GroupDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(GroupDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(GroupDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(GroupDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(GroupDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(GroupDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(GroupDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Group object - * - * @param Group|PropelObjectCollection $group The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return GroupDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByGroup($group, $comparison = null) - { - if ($group instanceof Group) { - return $this - ->addUsingAlias(GroupDescPeer::GROUP_ID, $group->getId(), $comparison); - } elseif ($group instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(GroupDescPeer::GROUP_ID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByGroup() only accepts arguments of type Group or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Group relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function joinGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Group'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Group'); - } - - return $this; - } - - /** - * Use the Group relation Group object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\GroupQuery A secondary query class using the current class as primary query - */ - public function useGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinGroup($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Group', '\Thelia\Model\GroupQuery'); - } - - /** - * Exclude object from result - * - * @param GroupDesc $groupDesc Object to remove from the list of results - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function prune($groupDesc = null) - { - if ($groupDesc) { - $this->addUsingAlias(GroupDescPeer::ID, $groupDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(GroupDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(GroupDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(GroupDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(GroupDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(GroupDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return GroupDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(GroupDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseImageDesc.php b/core/lib/Thelia/Model/om/BaseImageDesc.php deleted file mode 100644 index d6db7b517..000000000 --- a/core/lib/Thelia/Model/om/BaseImageDesc.php +++ /dev/null @@ -1,1290 +0,0 @@ -id; - } - - /** - * Get the [image_id] column value. - * - * @return int - */ - public function getImageId() - { - return $this->image_id; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return ImageDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = ImageDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [image_id] column. - * - * @param int $v new value - * @return ImageDesc The current object (for fluent API support) - */ - public function setImageId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->image_id !== $v) { - $this->image_id = $v; - $this->modifiedColumns[] = ImageDescPeer::IMAGE_ID; - } - - if ($this->aImage !== null && $this->aImage->getId() !== $v) { - $this->aImage = null; - } - - - return $this; - } // setImageId() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return ImageDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = ImageDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return ImageDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = ImageDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return ImageDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = ImageDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ImageDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = ImageDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ImageDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = ImageDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->image_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->created_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->updated_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 7; // 7 = ImageDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating ImageDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aImage !== null && $this->image_id !== $this->aImage->getId()) { - $this->aImage = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = ImageDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aImage = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = ImageDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(ImageDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(ImageDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ImageDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - ImageDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aImage !== null) { - if ($this->aImage->isModified() || $this->aImage->isNew()) { - $affectedRows += $this->aImage->save($con); - } - $this->setImage($this->aImage); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = ImageDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ImageDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ImageDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(ImageDescPeer::IMAGE_ID)) { - $modifiedColumns[':p' . $index++] = '`IMAGE_ID`'; - } - if ($this->isColumnModified(ImageDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(ImageDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(ImageDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(ImageDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(ImageDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `image_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`IMAGE_ID`': - $stmt->bindValue($identifier, $this->image_id, PDO::PARAM_INT); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aImage !== null) { - if (!$this->aImage->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aImage->getValidationFailures()); - } - } - - - if (($retval = ImageDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ImageDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getImageId(); - break; - case 2: - return $this->getTitle(); - break; - case 3: - return $this->getDescription(); - break; - case 4: - return $this->getChapo(); - break; - case 5: - return $this->getCreatedAt(); - break; - case 6: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['ImageDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['ImageDesc'][$this->getPrimaryKey()] = true; - $keys = ImageDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getImageId(), - $keys[2] => $this->getTitle(), - $keys[3] => $this->getDescription(), - $keys[4] => $this->getChapo(), - $keys[5] => $this->getCreatedAt(), - $keys[6] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aImage) { - $result['Image'] = $this->aImage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ImageDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setImageId($value); - break; - case 2: - $this->setTitle($value); - break; - case 3: - $this->setDescription($value); - break; - case 4: - $this->setChapo($value); - break; - case 5: - $this->setCreatedAt($value); - break; - case 6: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = ImageDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setImageId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(ImageDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(ImageDescPeer::ID)) $criteria->add(ImageDescPeer::ID, $this->id); - if ($this->isColumnModified(ImageDescPeer::IMAGE_ID)) $criteria->add(ImageDescPeer::IMAGE_ID, $this->image_id); - if ($this->isColumnModified(ImageDescPeer::TITLE)) $criteria->add(ImageDescPeer::TITLE, $this->title); - if ($this->isColumnModified(ImageDescPeer::DESCRIPTION)) $criteria->add(ImageDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(ImageDescPeer::CHAPO)) $criteria->add(ImageDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(ImageDescPeer::CREATED_AT)) $criteria->add(ImageDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ImageDescPeer::UPDATED_AT)) $criteria->add(ImageDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(ImageDescPeer::DATABASE_NAME); - $criteria->add(ImageDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of ImageDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setImageId($this->getImageId()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return ImageDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ImageDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new ImageDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Image object. - * - * @param Image $v - * @return ImageDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setImage(Image $v = null) - { - if ($v === null) { - $this->setImageId(NULL); - } else { - $this->setImageId($v->getId()); - } - - $this->aImage = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Image object, it will not be re-added. - if ($v !== null) { - $v->addImageDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Image object - * - * @param PropelPDO $con Optional Connection object. - * @return Image The associated Image object. - * @throws PropelException - */ - public function getImage(PropelPDO $con = null) - { - if ($this->aImage === null && ($this->image_id !== null)) { - $this->aImage = ImageQuery::create()->findPk($this->image_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aImage->addImageDescs($this); - */ - } - - return $this->aImage; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->image_id = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aImage = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(ImageDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return ImageDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = ImageDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseImageDescPeer.php b/core/lib/Thelia/Model/om/BaseImageDescPeer.php deleted file mode 100644 index 6025a9ebc..000000000 --- a/core/lib/Thelia/Model/om/BaseImageDescPeer.php +++ /dev/null @@ -1,1032 +0,0 @@ - array ('Id', 'ImageId', 'Title', 'Description', 'Chapo', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'imageId', 'title', 'description', 'chapo', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (ImageDescPeer::ID, ImageDescPeer::IMAGE_ID, ImageDescPeer::TITLE, ImageDescPeer::DESCRIPTION, ImageDescPeer::CHAPO, ImageDescPeer::CREATED_AT, ImageDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'IMAGE_ID', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'image_id', 'title', 'description', 'chapo', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. ImageDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'ImageId' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'imageId' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - BasePeer::TYPE_COLNAME => array (ImageDescPeer::ID => 0, ImageDescPeer::IMAGE_ID => 1, ImageDescPeer::TITLE => 2, ImageDescPeer::DESCRIPTION => 3, ImageDescPeer::CHAPO => 4, ImageDescPeer::CREATED_AT => 5, ImageDescPeer::UPDATED_AT => 6, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'IMAGE_ID' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'image_id' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'created_at' => 5, 'updated_at' => 6, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = ImageDescPeer::getFieldNames($toType); - $key = isset(ImageDescPeer::$fieldKeys[$fromType][$name]) ? ImageDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ImageDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, ImageDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return ImageDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ImageDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(ImageDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(ImageDescPeer::ID); - $criteria->addSelectColumn(ImageDescPeer::IMAGE_ID); - $criteria->addSelectColumn(ImageDescPeer::TITLE); - $criteria->addSelectColumn(ImageDescPeer::DESCRIPTION); - $criteria->addSelectColumn(ImageDescPeer::CHAPO); - $criteria->addSelectColumn(ImageDescPeer::CREATED_AT); - $criteria->addSelectColumn(ImageDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.IMAGE_ID'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ImageDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ImageDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(ImageDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return ImageDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = ImageDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return ImageDescPeer::populateObjects(ImageDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - ImageDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(ImageDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param ImageDesc $obj A ImageDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - ImageDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A ImageDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof ImageDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ImageDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(ImageDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return ImageDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(ImageDescPeer::$instances[$key])) { - return ImageDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - ImageDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to image_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = ImageDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = ImageDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = ImageDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - ImageDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (ImageDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = ImageDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = ImageDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + ImageDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = ImageDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - ImageDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Image table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinImage(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ImageDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ImageDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ImageDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ImageDescPeer::IMAGE_ID, ImagePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of ImageDesc objects pre-filled with their Image objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ImageDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinImage(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ImageDescPeer::DATABASE_NAME); - } - - ImageDescPeer::addSelectColumns($criteria); - $startcol = ImageDescPeer::NUM_HYDRATE_COLUMNS; - ImagePeer::addSelectColumns($criteria); - - $criteria->addJoin(ImageDescPeer::IMAGE_ID, ImagePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ImageDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ImageDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = ImageDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ImageDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = ImagePeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = ImagePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ImagePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - ImagePeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (ImageDesc) to $obj2 (Image) - $obj2->addImageDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ImageDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ImageDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ImageDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ImageDescPeer::IMAGE_ID, ImagePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of ImageDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ImageDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ImageDescPeer::DATABASE_NAME); - } - - ImageDescPeer::addSelectColumns($criteria); - $startcol2 = ImageDescPeer::NUM_HYDRATE_COLUMNS; - - ImagePeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + ImagePeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(ImageDescPeer::IMAGE_ID, ImagePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ImageDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ImageDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = ImageDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ImageDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Image rows - - $key2 = ImagePeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = ImagePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ImagePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - ImagePeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (ImageDesc) to the collection in $obj2 (Image) - $obj2->addImageDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(ImageDescPeer::DATABASE_NAME)->getTable(ImageDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseImageDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseImageDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new ImageDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return ImageDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a ImageDesc or Criteria object. - * - * @param mixed $values Criteria or ImageDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from ImageDesc object - } - - if ($criteria->containsKey(ImageDescPeer::ID) && $criteria->keyContainsValue(ImageDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImageDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(ImageDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a ImageDesc or Criteria object. - * - * @param mixed $values Criteria or ImageDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(ImageDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(ImageDescPeer::ID); - $value = $criteria->remove(ImageDescPeer::ID); - if ($value) { - $selectCriteria->add(ImageDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(ImageDescPeer::TABLE_NAME); - } - - } else { // $values is ImageDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(ImageDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the image_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(ImageDescPeer::TABLE_NAME, $con, ImageDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - ImageDescPeer::clearInstancePool(); - ImageDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a ImageDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or ImageDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - ImageDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof ImageDesc) { // it's a model object - // invalidate the cache for this single object - ImageDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(ImageDescPeer::DATABASE_NAME); - $criteria->add(ImageDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - ImageDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(ImageDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - ImageDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given ImageDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param ImageDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(ImageDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(ImageDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(ImageDescPeer::DATABASE_NAME, ImageDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return ImageDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = ImageDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(ImageDescPeer::DATABASE_NAME); - $criteria->add(ImageDescPeer::ID, $pk); - - $v = ImageDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return ImageDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(ImageDescPeer::DATABASE_NAME); - $criteria->add(ImageDescPeer::ID, $pks, Criteria::IN); - $objs = ImageDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseImageDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseImageDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseImageDescQuery.php b/core/lib/Thelia/Model/om/BaseImageDescQuery.php deleted file mode 100644 index 38c0abc11..000000000 --- a/core/lib/Thelia/Model/om/BaseImageDescQuery.php +++ /dev/null @@ -1,645 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return ImageDesc|ImageDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = ImageDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(ImageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ImageDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `IMAGE_ID`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `image_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new ImageDesc(); - $obj->hydrate($row); - ImageDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ImageDesc|ImageDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|ImageDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(ImageDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(ImageDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(ImageDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the image_id column - * - * Example usage: - * - * $query->filterByImageId(1234); // WHERE image_id = 1234 - * $query->filterByImageId(array(12, 34)); // WHERE image_id IN (12, 34) - * $query->filterByImageId(array('min' => 12)); // WHERE image_id > 12 - * - * - * @see filterByImage() - * - * @param mixed $imageId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function filterByImageId($imageId = null, $comparison = null) - { - if (is_array($imageId)) { - $useMinMax = false; - if (isset($imageId['min'])) { - $this->addUsingAlias(ImageDescPeer::IMAGE_ID, $imageId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($imageId['max'])) { - $this->addUsingAlias(ImageDescPeer::IMAGE_ID, $imageId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ImageDescPeer::IMAGE_ID, $imageId, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImageDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImageDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImageDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(ImageDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(ImageDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ImageDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(ImageDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(ImageDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ImageDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Image object - * - * @param Image|PropelObjectCollection $image The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImageDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByImage($image, $comparison = null) - { - if ($image instanceof Image) { - return $this - ->addUsingAlias(ImageDescPeer::IMAGE_ID, $image->getId(), $comparison); - } elseif ($image instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(ImageDescPeer::IMAGE_ID, $image->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByImage() only accepts arguments of type Image or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Image relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function joinImage($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Image'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Image'); - } - - return $this; - } - - /** - * Use the Image relation Image object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ImageQuery A secondary query class using the current class as primary query - */ - public function useImageQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinImage($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Image', '\Thelia\Model\ImageQuery'); - } - - /** - * Exclude object from result - * - * @param ImageDesc $imageDesc Object to remove from the list of results - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function prune($imageDesc = null) - { - if ($imageDesc) { - $this->addUsingAlias(ImageDescPeer::ID, $imageDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(ImageDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(ImageDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(ImageDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(ImageDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(ImageDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return ImageDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(ImageDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseMessageDesc.php b/core/lib/Thelia/Model/om/BaseMessageDesc.php deleted file mode 100644 index 65740e037..000000000 --- a/core/lib/Thelia/Model/om/BaseMessageDesc.php +++ /dev/null @@ -1,1345 +0,0 @@ -id; - } - - /** - * Get the [message_id] column value. - * - * @return int - */ - public function getMessageId() - { - return $this->message_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [description_html] column value. - * - * @return string - */ - public function getDescriptionHtml() - { - return $this->description_html; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return MessageDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = MessageDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [message_id] column. - * - * @param int $v new value - * @return MessageDesc The current object (for fluent API support) - */ - public function setMessageId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->message_id !== $v) { - $this->message_id = $v; - $this->modifiedColumns[] = MessageDescPeer::MESSAGE_ID; - } - - if ($this->aMessage !== null && $this->aMessage->getId() !== $v) { - $this->aMessage = null; - } - - - return $this; - } // setMessageId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return MessageDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = MessageDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return MessageDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = MessageDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return MessageDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = MessageDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [description_html] column. - * - * @param string $v new value - * @return MessageDesc The current object (for fluent API support) - */ - public function setDescriptionHtml($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description_html !== $v) { - $this->description_html = $v; - $this->modifiedColumns[] = MessageDescPeer::DESCRIPTION_HTML; - } - - - return $this; - } // setDescriptionHtml() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return MessageDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = MessageDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return MessageDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = MessageDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->message_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->description_html = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->updated_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = MessageDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating MessageDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aMessage !== null && $this->message_id !== $this->aMessage->getId()) { - $this->aMessage = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = MessageDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aMessage = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = MessageDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(MessageDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(MessageDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(MessageDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - MessageDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aMessage !== null) { - if ($this->aMessage->isModified() || $this->aMessage->isNew()) { - $affectedRows += $this->aMessage->save($con); - } - $this->setMessage($this->aMessage); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = MessageDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . MessageDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(MessageDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(MessageDescPeer::MESSAGE_ID)) { - $modifiedColumns[':p' . $index++] = '`MESSAGE_ID`'; - } - if ($this->isColumnModified(MessageDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(MessageDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(MessageDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(MessageDescPeer::DESCRIPTION_HTML)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION_HTML`'; - } - if ($this->isColumnModified(MessageDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(MessageDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `message_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`MESSAGE_ID`': - $stmt->bindValue($identifier, $this->message_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`DESCRIPTION_HTML`': - $stmt->bindValue($identifier, $this->description_html, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aMessage !== null) { - if (!$this->aMessage->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aMessage->getValidationFailures()); - } - } - - - if (($retval = MessageDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = MessageDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getMessageId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getDescriptionHtml(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['MessageDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['MessageDesc'][$this->getPrimaryKey()] = true; - $keys = MessageDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getMessageId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getDescriptionHtml(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aMessage) { - $result['Message'] = $this->aMessage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = MessageDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setMessageId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setDescriptionHtml($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = MessageDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setMessageId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDescriptionHtml($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(MessageDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(MessageDescPeer::ID)) $criteria->add(MessageDescPeer::ID, $this->id); - if ($this->isColumnModified(MessageDescPeer::MESSAGE_ID)) $criteria->add(MessageDescPeer::MESSAGE_ID, $this->message_id); - if ($this->isColumnModified(MessageDescPeer::LANG)) $criteria->add(MessageDescPeer::LANG, $this->lang); - if ($this->isColumnModified(MessageDescPeer::TITLE)) $criteria->add(MessageDescPeer::TITLE, $this->title); - if ($this->isColumnModified(MessageDescPeer::DESCRIPTION)) $criteria->add(MessageDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(MessageDescPeer::DESCRIPTION_HTML)) $criteria->add(MessageDescPeer::DESCRIPTION_HTML, $this->description_html); - if ($this->isColumnModified(MessageDescPeer::CREATED_AT)) $criteria->add(MessageDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(MessageDescPeer::UPDATED_AT)) $criteria->add(MessageDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(MessageDescPeer::DATABASE_NAME); - $criteria->add(MessageDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of MessageDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setMessageId($this->getMessageId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setDescriptionHtml($this->getDescriptionHtml()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return MessageDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return MessageDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new MessageDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Message object. - * - * @param Message $v - * @return MessageDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setMessage(Message $v = null) - { - if ($v === null) { - $this->setMessageId(NULL); - } else { - $this->setMessageId($v->getId()); - } - - $this->aMessage = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Message object, it will not be re-added. - if ($v !== null) { - $v->addMessageDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Message object - * - * @param PropelPDO $con Optional Connection object. - * @return Message The associated Message object. - * @throws PropelException - */ - public function getMessage(PropelPDO $con = null) - { - if ($this->aMessage === null && ($this->message_id !== null)) { - $this->aMessage = MessageQuery::create()->findPk($this->message_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aMessage->addMessageDescs($this); - */ - } - - return $this->aMessage; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->message_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->description_html = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aMessage = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(MessageDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return MessageDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = MessageDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseMessageDescPeer.php b/core/lib/Thelia/Model/om/BaseMessageDescPeer.php deleted file mode 100644 index ec5f519ff..000000000 --- a/core/lib/Thelia/Model/om/BaseMessageDescPeer.php +++ /dev/null @@ -1,1037 +0,0 @@ - array ('Id', 'MessageId', 'Lang', 'Title', 'Description', 'DescriptionHtml', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'messageId', 'lang', 'title', 'description', 'descriptionHtml', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (MessageDescPeer::ID, MessageDescPeer::MESSAGE_ID, MessageDescPeer::LANG, MessageDescPeer::TITLE, MessageDescPeer::DESCRIPTION, MessageDescPeer::DESCRIPTION_HTML, MessageDescPeer::CREATED_AT, MessageDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'MESSAGE_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'DESCRIPTION_HTML', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'message_id', 'lang', 'title', 'description', 'description_html', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. MessageDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'MessageId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'DescriptionHtml' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'messageId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'descriptionHtml' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - BasePeer::TYPE_COLNAME => array (MessageDescPeer::ID => 0, MessageDescPeer::MESSAGE_ID => 1, MessageDescPeer::LANG => 2, MessageDescPeer::TITLE => 3, MessageDescPeer::DESCRIPTION => 4, MessageDescPeer::DESCRIPTION_HTML => 5, MessageDescPeer::CREATED_AT => 6, MessageDescPeer::UPDATED_AT => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'MESSAGE_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'DESCRIPTION_HTML' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'message_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'description_html' => 5, 'created_at' => 6, 'updated_at' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = MessageDescPeer::getFieldNames($toType); - $key = isset(MessageDescPeer::$fieldKeys[$fromType][$name]) ? MessageDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(MessageDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, MessageDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return MessageDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. MessageDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(MessageDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(MessageDescPeer::ID); - $criteria->addSelectColumn(MessageDescPeer::MESSAGE_ID); - $criteria->addSelectColumn(MessageDescPeer::LANG); - $criteria->addSelectColumn(MessageDescPeer::TITLE); - $criteria->addSelectColumn(MessageDescPeer::DESCRIPTION); - $criteria->addSelectColumn(MessageDescPeer::DESCRIPTION_HTML); - $criteria->addSelectColumn(MessageDescPeer::CREATED_AT); - $criteria->addSelectColumn(MessageDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.MESSAGE_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.DESCRIPTION_HTML'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(MessageDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - MessageDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(MessageDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return MessageDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = MessageDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return MessageDescPeer::populateObjects(MessageDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - MessageDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(MessageDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param MessageDesc $obj A MessageDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - MessageDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A MessageDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof MessageDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or MessageDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(MessageDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return MessageDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(MessageDescPeer::$instances[$key])) { - return MessageDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - MessageDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to message_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = MessageDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = MessageDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = MessageDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - MessageDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (MessageDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = MessageDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = MessageDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + MessageDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = MessageDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - MessageDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Message table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinMessage(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(MessageDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - MessageDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(MessageDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(MessageDescPeer::MESSAGE_ID, MessagePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of MessageDesc objects pre-filled with their Message objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of MessageDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinMessage(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(MessageDescPeer::DATABASE_NAME); - } - - MessageDescPeer::addSelectColumns($criteria); - $startcol = MessageDescPeer::NUM_HYDRATE_COLUMNS; - MessagePeer::addSelectColumns($criteria); - - $criteria->addJoin(MessageDescPeer::MESSAGE_ID, MessagePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = MessageDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = MessageDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = MessageDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - MessageDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = MessagePeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = MessagePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = MessagePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - MessagePeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (MessageDesc) to $obj2 (Message) - $obj2->addMessageDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(MessageDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - MessageDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(MessageDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(MessageDescPeer::MESSAGE_ID, MessagePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of MessageDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of MessageDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(MessageDescPeer::DATABASE_NAME); - } - - MessageDescPeer::addSelectColumns($criteria); - $startcol2 = MessageDescPeer::NUM_HYDRATE_COLUMNS; - - MessagePeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + MessagePeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(MessageDescPeer::MESSAGE_ID, MessagePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = MessageDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = MessageDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = MessageDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - MessageDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Message rows - - $key2 = MessagePeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = MessagePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = MessagePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - MessagePeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (MessageDesc) to the collection in $obj2 (Message) - $obj2->addMessageDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(MessageDescPeer::DATABASE_NAME)->getTable(MessageDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseMessageDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseMessageDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new MessageDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return MessageDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a MessageDesc or Criteria object. - * - * @param mixed $values Criteria or MessageDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from MessageDesc object - } - - if ($criteria->containsKey(MessageDescPeer::ID) && $criteria->keyContainsValue(MessageDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.MessageDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(MessageDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a MessageDesc or Criteria object. - * - * @param mixed $values Criteria or MessageDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(MessageDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(MessageDescPeer::ID); - $value = $criteria->remove(MessageDescPeer::ID); - if ($value) { - $selectCriteria->add(MessageDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(MessageDescPeer::TABLE_NAME); - } - - } else { // $values is MessageDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(MessageDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the message_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(MessageDescPeer::TABLE_NAME, $con, MessageDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - MessageDescPeer::clearInstancePool(); - MessageDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a MessageDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or MessageDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - MessageDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof MessageDesc) { // it's a model object - // invalidate the cache for this single object - MessageDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(MessageDescPeer::DATABASE_NAME); - $criteria->add(MessageDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - MessageDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(MessageDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - MessageDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given MessageDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param MessageDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(MessageDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(MessageDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(MessageDescPeer::DATABASE_NAME, MessageDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return MessageDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = MessageDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(MessageDescPeer::DATABASE_NAME); - $criteria->add(MessageDescPeer::ID, $pk); - - $v = MessageDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return MessageDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(MessageDescPeer::DATABASE_NAME); - $criteria->add(MessageDescPeer::ID, $pks, Criteria::IN); - $objs = MessageDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseMessageDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseMessageDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseMessageDescQuery.php b/core/lib/Thelia/Model/om/BaseMessageDescQuery.php deleted file mode 100644 index f71b3c23f..000000000 --- a/core/lib/Thelia/Model/om/BaseMessageDescQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return MessageDesc|MessageDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = MessageDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(MessageDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return MessageDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `MESSAGE_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `DESCRIPTION_HTML`, `CREATED_AT`, `UPDATED_AT` FROM `message_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new MessageDesc(); - $obj->hydrate($row); - MessageDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return MessageDesc|MessageDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|MessageDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(MessageDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(MessageDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(MessageDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the message_id column - * - * Example usage: - * - * $query->filterByMessageId(1234); // WHERE message_id = 1234 - * $query->filterByMessageId(array(12, 34)); // WHERE message_id IN (12, 34) - * $query->filterByMessageId(array('min' => 12)); // WHERE message_id > 12 - * - * - * @see filterByMessage() - * - * @param mixed $messageId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function filterByMessageId($messageId = null, $comparison = null) - { - if (is_array($messageId)) { - $useMinMax = false; - if (isset($messageId['min'])) { - $this->addUsingAlias(MessageDescPeer::MESSAGE_ID, $messageId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($messageId['max'])) { - $this->addUsingAlias(MessageDescPeer::MESSAGE_ID, $messageId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(MessageDescPeer::MESSAGE_ID, $messageId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(MessageDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(MessageDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(MessageDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the description_html column - * - * Example usage: - * - * $query->filterByDescriptionHtml('fooValue'); // WHERE description_html = 'fooValue' - * $query->filterByDescriptionHtml('%fooValue%'); // WHERE description_html LIKE '%fooValue%' - * - * - * @param string $descriptionHtml The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function filterByDescriptionHtml($descriptionHtml = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($descriptionHtml)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $descriptionHtml)) { - $descriptionHtml = str_replace('*', '%', $descriptionHtml); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(MessageDescPeer::DESCRIPTION_HTML, $descriptionHtml, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(MessageDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(MessageDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(MessageDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(MessageDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(MessageDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(MessageDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Message object - * - * @param Message|PropelObjectCollection $message The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return MessageDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByMessage($message, $comparison = null) - { - if ($message instanceof Message) { - return $this - ->addUsingAlias(MessageDescPeer::MESSAGE_ID, $message->getId(), $comparison); - } elseif ($message instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(MessageDescPeer::MESSAGE_ID, $message->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByMessage() only accepts arguments of type Message or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Message relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function joinMessage($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Message'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Message'); - } - - return $this; - } - - /** - * Use the Message relation Message object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\MessageQuery A secondary query class using the current class as primary query - */ - public function useMessageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinMessage($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Message', '\Thelia\Model\MessageQuery'); - } - - /** - * Exclude object from result - * - * @param MessageDesc $messageDesc Object to remove from the list of results - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function prune($messageDesc = null) - { - if ($messageDesc) { - $this->addUsingAlias(MessageDescPeer::ID, $messageDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(MessageDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(MessageDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(MessageDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(MessageDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(MessageDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return MessageDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(MessageDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseModule.php b/core/lib/Thelia/Model/om/BaseModule.php index a7526041e..8882fe594 100644 --- a/core/lib/Thelia/Model/om/BaseModule.php +++ b/core/lib/Thelia/Model/om/BaseModule.php @@ -64,10 +64,10 @@ abstract class BaseModule extends BaseObject implements Persistent protected $code; /** - * The value for the type field. + * The value for the type field. * @var int */ - protected $ type; + protected $type; /** * The value for the activate field. @@ -172,13 +172,13 @@ abstract class BaseModule extends BaseObject implements Persistent } /** - * Get the [ type] column value. + * Get the [type] column value. * * @return int */ - public function get type() + public function getType() { - return $this-> type; + return $this->type; } /** @@ -324,25 +324,25 @@ abstract class BaseModule extends BaseObject implements Persistent } // setCode() /** - * Set the value of [ type] column. + * Set the value of [type] column. * * @param int $v new value * @return Module The current object (for fluent API support) */ - public function set type($v) + public function setType($v) { if ($v !== null && is_numeric($v)) { $v = (int) $v; } - if ($this-> type !== $v) { - $this-> type = $v; - $this->modifiedColumns[] = ModulePeer:: TYPE; + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = ModulePeer::TYPE; } return $this; - } // set type() + } // setType() /** * Set the value of [activate] column. @@ -466,7 +466,7 @@ abstract class BaseModule extends BaseObject implements Persistent $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->code = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this-> type = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->type = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; $this->activate = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; $this->position = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; $this->created_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; @@ -743,8 +743,8 @@ abstract class BaseModule extends BaseObject implements Persistent if ($this->isColumnModified(ModulePeer::CODE)) { $modifiedColumns[':p' . $index++] = '`code`'; } - if ($this->isColumnModified(ModulePeer:: TYPE)) { - $modifiedColumns[':p' . $index++] = '` type`'; + if ($this->isColumnModified(ModulePeer::TYPE)) { + $modifiedColumns[':p' . $index++] = '`type`'; } if ($this->isColumnModified(ModulePeer::ACTIVATE)) { $modifiedColumns[':p' . $index++] = '`activate`'; @@ -775,8 +775,8 @@ abstract class BaseModule extends BaseObject implements Persistent case '`code`': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case '` type`': - $stmt->bindValue($identifier, $this-> type, PDO::PARAM_INT); + case '`type`': + $stmt->bindValue($identifier, $this->type, PDO::PARAM_INT); break; case '`activate`': $stmt->bindValue($identifier, $this->activate, PDO::PARAM_INT); @@ -940,7 +940,7 @@ abstract class BaseModule extends BaseObject implements Persistent return $this->getCode(); break; case 2: - return $this->get type(); + return $this->getType(); break; case 3: return $this->getActivate(); @@ -985,7 +985,7 @@ abstract class BaseModule extends BaseObject implements Persistent $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getCode(), - $keys[2] => $this->get type(), + $keys[2] => $this->getType(), $keys[3] => $this->getActivate(), $keys[4] => $this->getPosition(), $keys[5] => $this->getCreatedAt(), @@ -1039,7 +1039,7 @@ abstract class BaseModule extends BaseObject implements Persistent $this->setCode($value); break; case 2: - $this->set type($value); + $this->setType($value); break; case 3: $this->setActivate($value); @@ -1079,7 +1079,7 @@ abstract class BaseModule extends BaseObject implements Persistent if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->set type($arr[$keys[2]]); + if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setActivate($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); @@ -1097,7 +1097,7 @@ abstract class BaseModule extends BaseObject implements Persistent if ($this->isColumnModified(ModulePeer::ID)) $criteria->add(ModulePeer::ID, $this->id); if ($this->isColumnModified(ModulePeer::CODE)) $criteria->add(ModulePeer::CODE, $this->code); - if ($this->isColumnModified(ModulePeer:: TYPE)) $criteria->add(ModulePeer:: TYPE, $this-> type); + if ($this->isColumnModified(ModulePeer::TYPE)) $criteria->add(ModulePeer::TYPE, $this->type); if ($this->isColumnModified(ModulePeer::ACTIVATE)) $criteria->add(ModulePeer::ACTIVATE, $this->activate); if ($this->isColumnModified(ModulePeer::POSITION)) $criteria->add(ModulePeer::POSITION, $this->position); if ($this->isColumnModified(ModulePeer::CREATED_AT)) $criteria->add(ModulePeer::CREATED_AT, $this->created_at); @@ -1166,7 +1166,7 @@ abstract class BaseModule extends BaseObject implements Persistent public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setCode($this->getCode()); - $copyObj->set type($this->get type()); + $copyObj->setType($this->getType()); $copyObj->setActivate($this->getActivate()); $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); @@ -1732,7 +1732,7 @@ abstract class BaseModule extends BaseObject implements Persistent { $this->id = null; $this->code = null; - $this-> type = null; + $this->type = null; $this->activate = null; $this->position = null; $this->created_at = null; diff --git a/core/lib/Thelia/Model/om/BaseModuleDesc.php b/core/lib/Thelia/Model/om/BaseModuleDesc.php deleted file mode 100644 index f01d9c07a..000000000 --- a/core/lib/Thelia/Model/om/BaseModuleDesc.php +++ /dev/null @@ -1,1400 +0,0 @@ -id; - } - - /** - * Get the [module_id] column value. - * - * @return int - */ - public function getModuleId() - { - return $this->module_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [currency_id] column value. - * - * @return int - */ - public function getCurrencyId() - { - return $this->currency_id; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return ModuleDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = ModuleDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [module_id] column. - * - * @param int $v new value - * @return ModuleDesc The current object (for fluent API support) - */ - public function setModuleId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->module_id !== $v) { - $this->module_id = $v; - $this->modifiedColumns[] = ModuleDescPeer::MODULE_ID; - } - - if ($this->aModule !== null && $this->aModule->getId() !== $v) { - $this->aModule = null; - } - - - return $this; - } // setModuleId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return ModuleDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = ModuleDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return ModuleDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = ModuleDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return ModuleDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = ModuleDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return ModuleDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = ModuleDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Set the value of [currency_id] column. - * - * @param int $v new value - * @return ModuleDesc The current object (for fluent API support) - */ - public function setCurrencyId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->currency_id !== $v) { - $this->currency_id = $v; - $this->modifiedColumns[] = ModuleDescPeer::CURRENCY_ID; - } - - - return $this; - } // setCurrencyId() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ModuleDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = ModuleDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ModuleDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = ModuleDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->module_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->currency_id = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; - $this->created_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->updated_at = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 9; // 9 = ModuleDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating ModuleDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aModule !== null && $this->module_id !== $this->aModule->getId()) { - $this->aModule = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = ModuleDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aModule = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = ModuleDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(ModuleDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(ModuleDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ModuleDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - ModuleDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aModule !== null) { - if ($this->aModule->isModified() || $this->aModule->isNew()) { - $affectedRows += $this->aModule->save($con); - } - $this->setModule($this->aModule); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = ModuleDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ModuleDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ModuleDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(ModuleDescPeer::MODULE_ID)) { - $modifiedColumns[':p' . $index++] = '`MODULE_ID`'; - } - if ($this->isColumnModified(ModuleDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(ModuleDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(ModuleDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(ModuleDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(ModuleDescPeer::CURRENCY_ID)) { - $modifiedColumns[':p' . $index++] = '`CURRENCY_ID`'; - } - if ($this->isColumnModified(ModuleDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(ModuleDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `module_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`MODULE_ID`': - $stmt->bindValue($identifier, $this->module_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CURRENCY_ID`': - $stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aModule !== null) { - if (!$this->aModule->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aModule->getValidationFailures()); - } - } - - - if (($retval = ModuleDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ModuleDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getModuleId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getCurrencyId(); - break; - case 7: - return $this->getCreatedAt(); - break; - case 8: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['ModuleDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['ModuleDesc'][$this->getPrimaryKey()] = true; - $keys = ModuleDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getModuleId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getCurrencyId(), - $keys[7] => $this->getCreatedAt(), - $keys[8] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aModule) { - $result['Module'] = $this->aModule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ModuleDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setModuleId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setCurrencyId($value); - break; - case 7: - $this->setCreatedAt($value); - break; - case 8: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = ModuleDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setModuleId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCurrencyId($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(ModuleDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(ModuleDescPeer::ID)) $criteria->add(ModuleDescPeer::ID, $this->id); - if ($this->isColumnModified(ModuleDescPeer::MODULE_ID)) $criteria->add(ModuleDescPeer::MODULE_ID, $this->module_id); - if ($this->isColumnModified(ModuleDescPeer::LANG)) $criteria->add(ModuleDescPeer::LANG, $this->lang); - if ($this->isColumnModified(ModuleDescPeer::TITLE)) $criteria->add(ModuleDescPeer::TITLE, $this->title); - if ($this->isColumnModified(ModuleDescPeer::DESCRIPTION)) $criteria->add(ModuleDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(ModuleDescPeer::CHAPO)) $criteria->add(ModuleDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(ModuleDescPeer::CURRENCY_ID)) $criteria->add(ModuleDescPeer::CURRENCY_ID, $this->currency_id); - if ($this->isColumnModified(ModuleDescPeer::CREATED_AT)) $criteria->add(ModuleDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ModuleDescPeer::UPDATED_AT)) $criteria->add(ModuleDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(ModuleDescPeer::DATABASE_NAME); - $criteria->add(ModuleDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of ModuleDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setModuleId($this->getModuleId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCurrencyId($this->getCurrencyId()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return ModuleDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ModuleDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new ModuleDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Module object. - * - * @param Module $v - * @return ModuleDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setModule(Module $v = null) - { - if ($v === null) { - $this->setModuleId(NULL); - } else { - $this->setModuleId($v->getId()); - } - - $this->aModule = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Module object, it will not be re-added. - if ($v !== null) { - $v->addModuleDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Module object - * - * @param PropelPDO $con Optional Connection object. - * @return Module The associated Module object. - * @throws PropelException - */ - public function getModule(PropelPDO $con = null) - { - if ($this->aModule === null && ($this->module_id !== null)) { - $this->aModule = ModuleQuery::create()->findPk($this->module_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aModule->addModuleDescs($this); - */ - } - - return $this->aModule; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->module_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->currency_id = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aModule = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(ModuleDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return ModuleDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = ModuleDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseModuleDescPeer.php b/core/lib/Thelia/Model/om/BaseModuleDescPeer.php deleted file mode 100644 index c6c1dbb3e..000000000 --- a/core/lib/Thelia/Model/om/BaseModuleDescPeer.php +++ /dev/null @@ -1,1042 +0,0 @@ - array ('Id', 'ModuleId', 'Lang', 'Title', 'Description', 'Chapo', 'CurrencyId', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'moduleId', 'lang', 'title', 'description', 'chapo', 'currencyId', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (ModuleDescPeer::ID, ModuleDescPeer::MODULE_ID, ModuleDescPeer::LANG, ModuleDescPeer::TITLE, ModuleDescPeer::DESCRIPTION, ModuleDescPeer::CHAPO, ModuleDescPeer::CURRENCY_ID, ModuleDescPeer::CREATED_AT, ModuleDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'MODULE_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CURRENCY_ID', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'module_id', 'lang', 'title', 'description', 'chapo', 'currency_id', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. ModuleDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'ModuleId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'CurrencyId' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'moduleId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'currencyId' => 6, 'createdAt' => 7, 'updatedAt' => 8, ), - BasePeer::TYPE_COLNAME => array (ModuleDescPeer::ID => 0, ModuleDescPeer::MODULE_ID => 1, ModuleDescPeer::LANG => 2, ModuleDescPeer::TITLE => 3, ModuleDescPeer::DESCRIPTION => 4, ModuleDescPeer::CHAPO => 5, ModuleDescPeer::CURRENCY_ID => 6, ModuleDescPeer::CREATED_AT => 7, ModuleDescPeer::UPDATED_AT => 8, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'MODULE_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'CURRENCY_ID' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'module_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'currency_id' => 6, 'created_at' => 7, 'updated_at' => 8, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = ModuleDescPeer::getFieldNames($toType); - $key = isset(ModuleDescPeer::$fieldKeys[$fromType][$name]) ? ModuleDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ModuleDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, ModuleDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return ModuleDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ModuleDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(ModuleDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(ModuleDescPeer::ID); - $criteria->addSelectColumn(ModuleDescPeer::MODULE_ID); - $criteria->addSelectColumn(ModuleDescPeer::LANG); - $criteria->addSelectColumn(ModuleDescPeer::TITLE); - $criteria->addSelectColumn(ModuleDescPeer::DESCRIPTION); - $criteria->addSelectColumn(ModuleDescPeer::CHAPO); - $criteria->addSelectColumn(ModuleDescPeer::CURRENCY_ID); - $criteria->addSelectColumn(ModuleDescPeer::CREATED_AT); - $criteria->addSelectColumn(ModuleDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.MODULE_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CURRENCY_ID'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ModuleDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ModuleDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(ModuleDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return ModuleDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = ModuleDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return ModuleDescPeer::populateObjects(ModuleDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - ModuleDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(ModuleDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param ModuleDesc $obj A ModuleDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - ModuleDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A ModuleDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof ModuleDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ModuleDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(ModuleDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return ModuleDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(ModuleDescPeer::$instances[$key])) { - return ModuleDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - ModuleDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to module_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = ModuleDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = ModuleDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = ModuleDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - ModuleDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (ModuleDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = ModuleDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = ModuleDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + ModuleDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = ModuleDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - ModuleDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Module table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinModule(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ModuleDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ModuleDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ModuleDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ModuleDescPeer::MODULE_ID, ModulePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of ModuleDesc objects pre-filled with their Module objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ModuleDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinModule(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ModuleDescPeer::DATABASE_NAME); - } - - ModuleDescPeer::addSelectColumns($criteria); - $startcol = ModuleDescPeer::NUM_HYDRATE_COLUMNS; - ModulePeer::addSelectColumns($criteria); - - $criteria->addJoin(ModuleDescPeer::MODULE_ID, ModulePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ModuleDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ModuleDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = ModuleDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ModuleDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = ModulePeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = ModulePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ModulePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - ModulePeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (ModuleDesc) to $obj2 (Module) - $obj2->addModuleDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ModuleDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ModuleDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ModuleDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ModuleDescPeer::MODULE_ID, ModulePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of ModuleDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ModuleDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ModuleDescPeer::DATABASE_NAME); - } - - ModuleDescPeer::addSelectColumns($criteria); - $startcol2 = ModuleDescPeer::NUM_HYDRATE_COLUMNS; - - ModulePeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + ModulePeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(ModuleDescPeer::MODULE_ID, ModulePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ModuleDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ModuleDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = ModuleDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ModuleDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Module rows - - $key2 = ModulePeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = ModulePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ModulePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - ModulePeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (ModuleDesc) to the collection in $obj2 (Module) - $obj2->addModuleDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(ModuleDescPeer::DATABASE_NAME)->getTable(ModuleDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseModuleDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseModuleDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new ModuleDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return ModuleDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a ModuleDesc or Criteria object. - * - * @param mixed $values Criteria or ModuleDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from ModuleDesc object - } - - if ($criteria->containsKey(ModuleDescPeer::ID) && $criteria->keyContainsValue(ModuleDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ModuleDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(ModuleDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a ModuleDesc or Criteria object. - * - * @param mixed $values Criteria or ModuleDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(ModuleDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(ModuleDescPeer::ID); - $value = $criteria->remove(ModuleDescPeer::ID); - if ($value) { - $selectCriteria->add(ModuleDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(ModuleDescPeer::TABLE_NAME); - } - - } else { // $values is ModuleDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(ModuleDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the module_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(ModuleDescPeer::TABLE_NAME, $con, ModuleDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - ModuleDescPeer::clearInstancePool(); - ModuleDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a ModuleDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or ModuleDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - ModuleDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof ModuleDesc) { // it's a model object - // invalidate the cache for this single object - ModuleDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(ModuleDescPeer::DATABASE_NAME); - $criteria->add(ModuleDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - ModuleDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(ModuleDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - ModuleDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given ModuleDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param ModuleDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(ModuleDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(ModuleDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(ModuleDescPeer::DATABASE_NAME, ModuleDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return ModuleDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = ModuleDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(ModuleDescPeer::DATABASE_NAME); - $criteria->add(ModuleDescPeer::ID, $pk); - - $v = ModuleDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return ModuleDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(ModuleDescPeer::DATABASE_NAME); - $criteria->add(ModuleDescPeer::ID, $pks, Criteria::IN); - $objs = ModuleDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseModuleDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseModuleDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseModuleDescQuery.php b/core/lib/Thelia/Model/om/BaseModuleDescQuery.php deleted file mode 100644 index 6b15d42f2..000000000 --- a/core/lib/Thelia/Model/om/BaseModuleDescQuery.php +++ /dev/null @@ -1,723 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return ModuleDesc|ModuleDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = ModuleDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(ModuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ModuleDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `MODULE_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CURRENCY_ID`, `CREATED_AT`, `UPDATED_AT` FROM `module_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new ModuleDesc(); - $obj->hydrate($row); - ModuleDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ModuleDesc|ModuleDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|ModuleDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(ModuleDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(ModuleDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(ModuleDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the module_id column - * - * Example usage: - * - * $query->filterByModuleId(1234); // WHERE module_id = 1234 - * $query->filterByModuleId(array(12, 34)); // WHERE module_id IN (12, 34) - * $query->filterByModuleId(array('min' => 12)); // WHERE module_id > 12 - * - * - * @see filterByModule() - * - * @param mixed $moduleId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterByModuleId($moduleId = null, $comparison = null) - { - if (is_array($moduleId)) { - $useMinMax = false; - if (isset($moduleId['min'])) { - $this->addUsingAlias(ModuleDescPeer::MODULE_ID, $moduleId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($moduleId['max'])) { - $this->addUsingAlias(ModuleDescPeer::MODULE_ID, $moduleId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModuleDescPeer::MODULE_ID, $moduleId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModuleDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModuleDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModuleDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModuleDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the currency_id column - * - * Example usage: - * - * $query->filterByCurrencyId(1234); // WHERE currency_id = 1234 - * $query->filterByCurrencyId(array(12, 34)); // WHERE currency_id IN (12, 34) - * $query->filterByCurrencyId(array('min' => 12)); // WHERE currency_id > 12 - * - * - * @param mixed $currencyId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterByCurrencyId($currencyId = null, $comparison = null) - { - if (is_array($currencyId)) { - $useMinMax = false; - if (isset($currencyId['min'])) { - $this->addUsingAlias(ModuleDescPeer::CURRENCY_ID, $currencyId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($currencyId['max'])) { - $this->addUsingAlias(ModuleDescPeer::CURRENCY_ID, $currencyId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModuleDescPeer::CURRENCY_ID, $currencyId, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(ModuleDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(ModuleDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModuleDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(ModuleDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(ModuleDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModuleDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Module object - * - * @param Module|PropelObjectCollection $module The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModuleDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByModule($module, $comparison = null) - { - if ($module instanceof Module) { - return $this - ->addUsingAlias(ModuleDescPeer::MODULE_ID, $module->getId(), $comparison); - } elseif ($module instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(ModuleDescPeer::MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByModule() only accepts arguments of type Module or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Module relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Module'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Module'); - } - - return $this; - } - - /** - * Use the Module relation Module object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query - */ - public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinModule($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery'); - } - - /** - * Exclude object from result - * - * @param ModuleDesc $moduleDesc Object to remove from the list of results - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function prune($moduleDesc = null) - { - if ($moduleDesc) { - $this->addUsingAlias(ModuleDescPeer::ID, $moduleDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(ModuleDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(ModuleDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(ModuleDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(ModuleDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(ModuleDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return ModuleDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(ModuleDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseModulePeer.php b/core/lib/Thelia/Model/om/BaseModulePeer.php index 48938f90d..806ad5bb3 100644 --- a/core/lib/Thelia/Model/om/BaseModulePeer.php +++ b/core/lib/Thelia/Model/om/BaseModulePeer.php @@ -52,8 +52,8 @@ abstract class BaseModulePeer /** the column name for the code field */ const CODE = 'module.code'; - /** the column name for the type field */ - const TYPE = 'module. type'; + /** the column name for the type field */ + const TYPE = 'module.type'; /** the column name for the activate field */ const ACTIVATE = 'module.activate'; @@ -93,11 +93,11 @@ abstract class BaseModulePeer * e.g. ModulePeer::$fieldNames[ModulePeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('Id', 'Code', ' type', 'Activate', 'Position', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'code', ' type', 'activate', 'position', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (ModulePeer::ID, ModulePeer::CODE, ModulePeer:: TYPE, ModulePeer::ACTIVATE, ModulePeer::POSITION, ModulePeer::CREATED_AT, ModulePeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', ' TYPE', 'ACTIVATE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'code', ' type', 'activate', 'position', 'created_at', 'updated_at', ), + BasePeer::TYPE_PHPNAME => array ('Id', 'Code', 'Type', 'Activate', 'Position', 'CreatedAt', 'UpdatedAt', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'code', 'type', 'activate', 'position', 'createdAt', 'updatedAt', ), + BasePeer::TYPE_COLNAME => array (ModulePeer::ID, ModulePeer::CODE, ModulePeer::TYPE, ModulePeer::ACTIVATE, ModulePeer::POSITION, ModulePeer::CREATED_AT, ModulePeer::UPDATED_AT, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'type', 'activate', 'position', 'created_at', 'updated_at', ), BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); @@ -108,11 +108,11 @@ abstract class BaseModulePeer * e.g. ModulePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Code' => 1, ' type' => 2, 'Activate' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'code' => 1, ' type' => 2, 'activate' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - BasePeer::TYPE_COLNAME => array (ModulePeer::ID => 0, ModulePeer::CODE => 1, ModulePeer:: TYPE => 2, ModulePeer::ACTIVATE => 3, ModulePeer::POSITION => 4, ModulePeer::CREATED_AT => 5, ModulePeer::UPDATED_AT => 6, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, ' TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, ' type' => 2, 'activate' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ), + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), + BasePeer::TYPE_COLNAME => array (ModulePeer::ID => 0, ModulePeer::CODE => 1, ModulePeer::TYPE => 2, ModulePeer::ACTIVATE => 3, ModulePeer::POSITION => 4, ModulePeer::CREATED_AT => 5, ModulePeer::UPDATED_AT => 6, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ), BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); @@ -189,7 +189,7 @@ abstract class BaseModulePeer if (null === $alias) { $criteria->addSelectColumn(ModulePeer::ID); $criteria->addSelectColumn(ModulePeer::CODE); - $criteria->addSelectColumn(ModulePeer:: TYPE); + $criteria->addSelectColumn(ModulePeer::TYPE); $criteria->addSelectColumn(ModulePeer::ACTIVATE); $criteria->addSelectColumn(ModulePeer::POSITION); $criteria->addSelectColumn(ModulePeer::CREATED_AT); @@ -197,7 +197,7 @@ abstract class BaseModulePeer } else { $criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.code'); - $criteria->addSelectColumn($alias . '. type'); + $criteria->addSelectColumn($alias . '.type'); $criteria->addSelectColumn($alias . '.activate'); $criteria->addSelectColumn($alias . '.position'); $criteria->addSelectColumn($alias . '.created_at'); diff --git a/core/lib/Thelia/Model/om/BaseModuleQuery.php b/core/lib/Thelia/Model/om/BaseModuleQuery.php index aa0eaaff2..66b9225c7 100644 --- a/core/lib/Thelia/Model/om/BaseModuleQuery.php +++ b/core/lib/Thelia/Model/om/BaseModuleQuery.php @@ -25,7 +25,7 @@ use Thelia\Model\ModuleQuery; * * @method ModuleQuery orderById($order = Criteria::ASC) Order by the id column * @method ModuleQuery orderByCode($order = Criteria::ASC) Order by the code column - * @method ModuleQuery orderBy type($order = Criteria::ASC) Order by the type column + * @method ModuleQuery orderByType($order = Criteria::ASC) Order by the type column * @method ModuleQuery orderByActivate($order = Criteria::ASC) Order by the activate column * @method ModuleQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column @@ -33,7 +33,7 @@ use Thelia\Model\ModuleQuery; * * @method ModuleQuery groupById() Group by the id column * @method ModuleQuery groupByCode() Group by the code column - * @method ModuleQuery groupBy type() Group by the type column + * @method ModuleQuery groupByType() Group by the type column * @method ModuleQuery groupByActivate() Group by the activate column * @method ModuleQuery groupByPosition() Group by the position column * @method ModuleQuery groupByCreatedAt() Group by the created_at column @@ -55,7 +55,7 @@ use Thelia\Model\ModuleQuery; * @method Module findOneOrCreate(PropelPDO $con = null) Return the first Module matching the query, or a new Module object populated from the query conditions when no match is found * * @method Module findOneByCode(string $code) Return the first Module filtered by the code column - * @method Module findOneBy type(int $ type) Return the first Module filtered by the type column + * @method Module findOneByType(int $type) Return the first Module filtered by the type column * @method Module findOneByActivate(int $activate) Return the first Module filtered by the activate column * @method Module findOneByPosition(int $position) Return the first Module filtered by the position column * @method Module findOneByCreatedAt(string $created_at) Return the first Module filtered by the created_at column @@ -63,7 +63,7 @@ use Thelia\Model\ModuleQuery; * * @method array findById(int $id) Return Module objects filtered by the id column * @method array findByCode(string $code) Return Module objects filtered by the code column - * @method array findBy type(int $ type) Return Module objects filtered by the type column + * @method array findByType(int $type) Return Module objects filtered by the type column * @method array findByActivate(int $activate) Return Module objects filtered by the activate column * @method array findByPosition(int $position) Return Module objects filtered by the position column * @method array findByCreatedAt(string $created_at) Return Module objects filtered by the created_at column @@ -171,7 +171,7 @@ abstract class BaseModuleQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT `id`, `code`, ` type`, `activate`, `position`, `created_at`, `updated_at` FROM `module` WHERE `id` = :p0'; + $sql = 'SELECT `id`, `code`, `type`, `activate`, `position`, `created_at`, `updated_at` FROM `module` WHERE `id` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -332,17 +332,17 @@ abstract class BaseModuleQuery extends ModelCriteria } /** - * Filter the query on the type column + * Filter the query on the type column * * Example usage: * - * $query->filterBy type(1234); // WHERE type = 1234 - * $query->filterBy type(array(12, 34)); // WHERE type IN (12, 34) - * $query->filterBy type(array('min' => 12)); // WHERE type >= 12 - * $query->filterBy type(array('max' => 12)); // WHERE type <= 12 + * $query->filterByType(1234); // WHERE type = 1234 + * $query->filterByType(array(12, 34)); // WHERE type IN (12, 34) + * $query->filterByType(array('min' => 12)); // WHERE type >= 12 + * $query->filterByType(array('max' => 12)); // WHERE type <= 12 * * - * @param mixed $ type The value to use as filter. + * @param mixed $type The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @@ -350,16 +350,16 @@ abstract class BaseModuleQuery extends ModelCriteria * * @return ModuleQuery The current query, for fluid interface */ - public function filterBy type($ type = null, $comparison = null) + public function filterByType($type = null, $comparison = null) { - if (is_array($ type)) { + if (is_array($type)) { $useMinMax = false; - if (isset($ type['min'])) { - $this->addUsingAlias(ModulePeer:: TYPE, $ type['min'], Criteria::GREATER_EQUAL); + if (isset($type['min'])) { + $this->addUsingAlias(ModulePeer::TYPE, $type['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($ type['max'])) { - $this->addUsingAlias(ModulePeer:: TYPE, $ type['max'], Criteria::LESS_EQUAL); + if (isset($type['max'])) { + $this->addUsingAlias(ModulePeer::TYPE, $type['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -370,7 +370,7 @@ abstract class BaseModuleQuery extends ModelCriteria } } - return $this->addUsingAlias(ModulePeer:: TYPE, $ type, $comparison); + return $this->addUsingAlias(ModulePeer::TYPE, $type, $comparison); } /** diff --git a/core/lib/Thelia/Model/om/BaseOrderStatusDesc.php b/core/lib/Thelia/Model/om/BaseOrderStatusDesc.php deleted file mode 100644 index 81dbcc692..000000000 --- a/core/lib/Thelia/Model/om/BaseOrderStatusDesc.php +++ /dev/null @@ -1,1345 +0,0 @@ -id; - } - - /** - * Get the [status_id] column value. - * - * @return int - */ - public function getStatusId() - { - return $this->status_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return OrderStatusDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = OrderStatusDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [status_id] column. - * - * @param int $v new value - * @return OrderStatusDesc The current object (for fluent API support) - */ - public function setStatusId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->status_id !== $v) { - $this->status_id = $v; - $this->modifiedColumns[] = OrderStatusDescPeer::STATUS_ID; - } - - if ($this->aOrderStatus !== null && $this->aOrderStatus->getId() !== $v) { - $this->aOrderStatus = null; - } - - - return $this; - } // setStatusId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return OrderStatusDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = OrderStatusDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return OrderStatusDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = OrderStatusDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return OrderStatusDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = OrderStatusDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return OrderStatusDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = OrderStatusDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return OrderStatusDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = OrderStatusDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return OrderStatusDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = OrderStatusDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->status_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->updated_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = OrderStatusDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating OrderStatusDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aOrderStatus !== null && $this->status_id !== $this->aOrderStatus->getId()) { - $this->aOrderStatus = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = OrderStatusDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aOrderStatus = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = OrderStatusDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(OrderStatusDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(OrderStatusDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(OrderStatusDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - OrderStatusDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aOrderStatus !== null) { - if ($this->aOrderStatus->isModified() || $this->aOrderStatus->isNew()) { - $affectedRows += $this->aOrderStatus->save($con); - } - $this->setOrderStatus($this->aOrderStatus); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = OrderStatusDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderStatusDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(OrderStatusDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(OrderStatusDescPeer::STATUS_ID)) { - $modifiedColumns[':p' . $index++] = '`STATUS_ID`'; - } - if ($this->isColumnModified(OrderStatusDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(OrderStatusDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(OrderStatusDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(OrderStatusDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(OrderStatusDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(OrderStatusDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `order_status_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`STATUS_ID`': - $stmt->bindValue($identifier, $this->status_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aOrderStatus !== null) { - if (!$this->aOrderStatus->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aOrderStatus->getValidationFailures()); - } - } - - - if (($retval = OrderStatusDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = OrderStatusDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getStatusId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['OrderStatusDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['OrderStatusDesc'][$this->getPrimaryKey()] = true; - $keys = OrderStatusDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getStatusId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aOrderStatus) { - $result['OrderStatus'] = $this->aOrderStatus->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = OrderStatusDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setStatusId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = OrderStatusDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setStatusId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(OrderStatusDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(OrderStatusDescPeer::ID)) $criteria->add(OrderStatusDescPeer::ID, $this->id); - if ($this->isColumnModified(OrderStatusDescPeer::STATUS_ID)) $criteria->add(OrderStatusDescPeer::STATUS_ID, $this->status_id); - if ($this->isColumnModified(OrderStatusDescPeer::LANG)) $criteria->add(OrderStatusDescPeer::LANG, $this->lang); - if ($this->isColumnModified(OrderStatusDescPeer::TITLE)) $criteria->add(OrderStatusDescPeer::TITLE, $this->title); - if ($this->isColumnModified(OrderStatusDescPeer::DESCRIPTION)) $criteria->add(OrderStatusDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(OrderStatusDescPeer::CHAPO)) $criteria->add(OrderStatusDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(OrderStatusDescPeer::CREATED_AT)) $criteria->add(OrderStatusDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(OrderStatusDescPeer::UPDATED_AT)) $criteria->add(OrderStatusDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(OrderStatusDescPeer::DATABASE_NAME); - $criteria->add(OrderStatusDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of OrderStatusDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setStatusId($this->getStatusId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return OrderStatusDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return OrderStatusDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new OrderStatusDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a OrderStatus object. - * - * @param OrderStatus $v - * @return OrderStatusDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setOrderStatus(OrderStatus $v = null) - { - if ($v === null) { - $this->setStatusId(NULL); - } else { - $this->setStatusId($v->getId()); - } - - $this->aOrderStatus = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the OrderStatus object, it will not be re-added. - if ($v !== null) { - $v->addOrderStatusDesc($this); - } - - - return $this; - } - - - /** - * Get the associated OrderStatus object - * - * @param PropelPDO $con Optional Connection object. - * @return OrderStatus The associated OrderStatus object. - * @throws PropelException - */ - public function getOrderStatus(PropelPDO $con = null) - { - if ($this->aOrderStatus === null && ($this->status_id !== null)) { - $this->aOrderStatus = OrderStatusQuery::create()->findPk($this->status_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aOrderStatus->addOrderStatusDescs($this); - */ - } - - return $this->aOrderStatus; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->status_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aOrderStatus = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(OrderStatusDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return OrderStatusDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = OrderStatusDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseOrderStatusDescPeer.php b/core/lib/Thelia/Model/om/BaseOrderStatusDescPeer.php deleted file mode 100644 index 963cda92b..000000000 --- a/core/lib/Thelia/Model/om/BaseOrderStatusDescPeer.php +++ /dev/null @@ -1,1037 +0,0 @@ - array ('Id', 'StatusId', 'Lang', 'Title', 'Description', 'Chapo', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'statusId', 'lang', 'title', 'description', 'chapo', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (OrderStatusDescPeer::ID, OrderStatusDescPeer::STATUS_ID, OrderStatusDescPeer::LANG, OrderStatusDescPeer::TITLE, OrderStatusDescPeer::DESCRIPTION, OrderStatusDescPeer::CHAPO, OrderStatusDescPeer::CREATED_AT, OrderStatusDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STATUS_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'status_id', 'lang', 'title', 'description', 'chapo', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. OrderStatusDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'StatusId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'statusId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - BasePeer::TYPE_COLNAME => array (OrderStatusDescPeer::ID => 0, OrderStatusDescPeer::STATUS_ID => 1, OrderStatusDescPeer::LANG => 2, OrderStatusDescPeer::TITLE => 3, OrderStatusDescPeer::DESCRIPTION => 4, OrderStatusDescPeer::CHAPO => 5, OrderStatusDescPeer::CREATED_AT => 6, OrderStatusDescPeer::UPDATED_AT => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STATUS_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'status_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'created_at' => 6, 'updated_at' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = OrderStatusDescPeer::getFieldNames($toType); - $key = isset(OrderStatusDescPeer::$fieldKeys[$fromType][$name]) ? OrderStatusDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(OrderStatusDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, OrderStatusDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return OrderStatusDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. OrderStatusDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(OrderStatusDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(OrderStatusDescPeer::ID); - $criteria->addSelectColumn(OrderStatusDescPeer::STATUS_ID); - $criteria->addSelectColumn(OrderStatusDescPeer::LANG); - $criteria->addSelectColumn(OrderStatusDescPeer::TITLE); - $criteria->addSelectColumn(OrderStatusDescPeer::DESCRIPTION); - $criteria->addSelectColumn(OrderStatusDescPeer::CHAPO); - $criteria->addSelectColumn(OrderStatusDescPeer::CREATED_AT); - $criteria->addSelectColumn(OrderStatusDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.STATUS_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(OrderStatusDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - OrderStatusDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(OrderStatusDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return OrderStatusDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = OrderStatusDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return OrderStatusDescPeer::populateObjects(OrderStatusDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - OrderStatusDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(OrderStatusDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param OrderStatusDesc $obj A OrderStatusDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - OrderStatusDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A OrderStatusDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof OrderStatusDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or OrderStatusDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(OrderStatusDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return OrderStatusDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(OrderStatusDescPeer::$instances[$key])) { - return OrderStatusDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - OrderStatusDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to order_status_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = OrderStatusDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = OrderStatusDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = OrderStatusDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - OrderStatusDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (OrderStatusDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = OrderStatusDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = OrderStatusDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + OrderStatusDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = OrderStatusDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - OrderStatusDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related OrderStatus table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinOrderStatus(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(OrderStatusDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - OrderStatusDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(OrderStatusDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(OrderStatusDescPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of OrderStatusDesc objects pre-filled with their OrderStatus objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of OrderStatusDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinOrderStatus(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(OrderStatusDescPeer::DATABASE_NAME); - } - - OrderStatusDescPeer::addSelectColumns($criteria); - $startcol = OrderStatusDescPeer::NUM_HYDRATE_COLUMNS; - OrderStatusPeer::addSelectColumns($criteria); - - $criteria->addJoin(OrderStatusDescPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = OrderStatusDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = OrderStatusDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = OrderStatusDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - OrderStatusDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = OrderStatusPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = OrderStatusPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = OrderStatusPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - OrderStatusPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (OrderStatusDesc) to $obj2 (OrderStatus) - $obj2->addOrderStatusDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(OrderStatusDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - OrderStatusDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(OrderStatusDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(OrderStatusDescPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of OrderStatusDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of OrderStatusDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(OrderStatusDescPeer::DATABASE_NAME); - } - - OrderStatusDescPeer::addSelectColumns($criteria); - $startcol2 = OrderStatusDescPeer::NUM_HYDRATE_COLUMNS; - - OrderStatusPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + OrderStatusPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(OrderStatusDescPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = OrderStatusDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = OrderStatusDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = OrderStatusDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - OrderStatusDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined OrderStatus rows - - $key2 = OrderStatusPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = OrderStatusPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = OrderStatusPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - OrderStatusPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (OrderStatusDesc) to the collection in $obj2 (OrderStatus) - $obj2->addOrderStatusDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(OrderStatusDescPeer::DATABASE_NAME)->getTable(OrderStatusDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseOrderStatusDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseOrderStatusDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new OrderStatusDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return OrderStatusDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a OrderStatusDesc or Criteria object. - * - * @param mixed $values Criteria or OrderStatusDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from OrderStatusDesc object - } - - if ($criteria->containsKey(OrderStatusDescPeer::ID) && $criteria->keyContainsValue(OrderStatusDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.OrderStatusDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(OrderStatusDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a OrderStatusDesc or Criteria object. - * - * @param mixed $values Criteria or OrderStatusDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(OrderStatusDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(OrderStatusDescPeer::ID); - $value = $criteria->remove(OrderStatusDescPeer::ID); - if ($value) { - $selectCriteria->add(OrderStatusDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(OrderStatusDescPeer::TABLE_NAME); - } - - } else { // $values is OrderStatusDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(OrderStatusDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the order_status_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(OrderStatusDescPeer::TABLE_NAME, $con, OrderStatusDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - OrderStatusDescPeer::clearInstancePool(); - OrderStatusDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a OrderStatusDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or OrderStatusDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - OrderStatusDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof OrderStatusDesc) { // it's a model object - // invalidate the cache for this single object - OrderStatusDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(OrderStatusDescPeer::DATABASE_NAME); - $criteria->add(OrderStatusDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - OrderStatusDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(OrderStatusDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - OrderStatusDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given OrderStatusDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param OrderStatusDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(OrderStatusDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(OrderStatusDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(OrderStatusDescPeer::DATABASE_NAME, OrderStatusDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return OrderStatusDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = OrderStatusDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(OrderStatusDescPeer::DATABASE_NAME); - $criteria->add(OrderStatusDescPeer::ID, $pk); - - $v = OrderStatusDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return OrderStatusDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(OrderStatusDescPeer::DATABASE_NAME); - $criteria->add(OrderStatusDescPeer::ID, $pks, Criteria::IN); - $objs = OrderStatusDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseOrderStatusDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseOrderStatusDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseOrderStatusDescQuery.php b/core/lib/Thelia/Model/om/BaseOrderStatusDescQuery.php deleted file mode 100644 index 05cdf6a44..000000000 --- a/core/lib/Thelia/Model/om/BaseOrderStatusDescQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return OrderStatusDesc|OrderStatusDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = OrderStatusDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(OrderStatusDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return OrderStatusDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `STATUS_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `order_status_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new OrderStatusDesc(); - $obj->hydrate($row); - OrderStatusDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return OrderStatusDesc|OrderStatusDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|OrderStatusDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(OrderStatusDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(OrderStatusDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(OrderStatusDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the status_id column - * - * Example usage: - * - * $query->filterByStatusId(1234); // WHERE status_id = 1234 - * $query->filterByStatusId(array(12, 34)); // WHERE status_id IN (12, 34) - * $query->filterByStatusId(array('min' => 12)); // WHERE status_id > 12 - * - * - * @see filterByOrderStatus() - * - * @param mixed $statusId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function filterByStatusId($statusId = null, $comparison = null) - { - if (is_array($statusId)) { - $useMinMax = false; - if (isset($statusId['min'])) { - $this->addUsingAlias(OrderStatusDescPeer::STATUS_ID, $statusId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($statusId['max'])) { - $this->addUsingAlias(OrderStatusDescPeer::STATUS_ID, $statusId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(OrderStatusDescPeer::STATUS_ID, $statusId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(OrderStatusDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(OrderStatusDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(OrderStatusDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(OrderStatusDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(OrderStatusDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(OrderStatusDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(OrderStatusDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(OrderStatusDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(OrderStatusDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(OrderStatusDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related OrderStatus object - * - * @param OrderStatus|PropelObjectCollection $orderStatus The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return OrderStatusDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByOrderStatus($orderStatus, $comparison = null) - { - if ($orderStatus instanceof OrderStatus) { - return $this - ->addUsingAlias(OrderStatusDescPeer::STATUS_ID, $orderStatus->getId(), $comparison); - } elseif ($orderStatus instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(OrderStatusDescPeer::STATUS_ID, $orderStatus->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByOrderStatus() only accepts arguments of type OrderStatus or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the OrderStatus relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function joinOrderStatus($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('OrderStatus'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'OrderStatus'); - } - - return $this; - } - - /** - * Use the OrderStatus relation OrderStatus object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\OrderStatusQuery A secondary query class using the current class as primary query - */ - public function useOrderStatusQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinOrderStatus($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'OrderStatus', '\Thelia\Model\OrderStatusQuery'); - } - - /** - * Exclude object from result - * - * @param OrderStatusDesc $orderStatusDesc Object to remove from the list of results - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function prune($orderStatusDesc = null) - { - if ($orderStatusDesc) { - $this->addUsingAlias(OrderStatusDescPeer::ID, $orderStatusDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(OrderStatusDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(OrderStatusDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(OrderStatusDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(OrderStatusDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(OrderStatusDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return OrderStatusDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(OrderStatusDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseProductDesc.php b/core/lib/Thelia/Model/om/BaseProductDesc.php deleted file mode 100644 index b8563d4d6..000000000 --- a/core/lib/Thelia/Model/om/BaseProductDesc.php +++ /dev/null @@ -1,1400 +0,0 @@ -id; - } - - /** - * Get the [product_id] column value. - * - * @return int - */ - public function getProductId() - { - return $this->product_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [chapo] column value. - * - * @return string - */ - public function getChapo() - { - return $this->chapo; - } - - /** - * Get the [postscriptum] column value. - * - * @return string - */ - public function getPostscriptum() - { - return $this->postscriptum; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return ProductDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = ProductDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [product_id] column. - * - * @param int $v new value - * @return ProductDesc The current object (for fluent API support) - */ - public function setProductId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->product_id !== $v) { - $this->product_id = $v; - $this->modifiedColumns[] = ProductDescPeer::PRODUCT_ID; - } - - if ($this->aProduct !== null && $this->aProduct->getId() !== $v) { - $this->aProduct = null; - } - - - return $this; - } // setProductId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return ProductDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = ProductDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return ProductDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = ProductDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return ProductDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = ProductDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Set the value of [chapo] column. - * - * @param string $v new value - * @return ProductDesc The current object (for fluent API support) - */ - public function setChapo($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = ProductDescPeer::CHAPO; - } - - - return $this; - } // setChapo() - - /** - * Set the value of [postscriptum] column. - * - * @param string $v new value - * @return ProductDesc The current object (for fluent API support) - */ - public function setPostscriptum($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->postscriptum !== $v) { - $this->postscriptum = $v; - $this->modifiedColumns[] = ProductDescPeer::POSTSCRIPTUM; - } - - - return $this; - } // setPostscriptum() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ProductDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = ProductDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ProductDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = ProductDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->product_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->chapo = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->postscriptum = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->created_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->updated_at = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 9; // 9 = ProductDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating ProductDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aProduct !== null && $this->product_id !== $this->aProduct->getId()) { - $this->aProduct = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = ProductDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aProduct = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = ProductDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(ProductDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(ProductDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ProductDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - ProductDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aProduct !== null) { - if ($this->aProduct->isModified() || $this->aProduct->isNew()) { - $affectedRows += $this->aProduct->save($con); - } - $this->setProduct($this->aProduct); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = ProductDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ProductDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ProductDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(ProductDescPeer::PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = '`PRODUCT_ID`'; - } - if ($this->isColumnModified(ProductDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(ProductDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(ProductDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(ProductDescPeer::CHAPO)) { - $modifiedColumns[':p' . $index++] = '`CHAPO`'; - } - if ($this->isColumnModified(ProductDescPeer::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; - } - if ($this->isColumnModified(ProductDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(ProductDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `product_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`PRODUCT_ID`': - $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CHAPO`': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); - break; - case '`POSTSCRIPTUM`': - $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aProduct !== null) { - if (!$this->aProduct->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aProduct->getValidationFailures()); - } - } - - - if (($retval = ProductDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ProductDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getProductId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getChapo(); - break; - case 6: - return $this->getPostscriptum(); - break; - case 7: - return $this->getCreatedAt(); - break; - case 8: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['ProductDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['ProductDesc'][$this->getPrimaryKey()] = true; - $keys = ProductDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getProductId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getChapo(), - $keys[6] => $this->getPostscriptum(), - $keys[7] => $this->getCreatedAt(), - $keys[8] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aProduct) { - $result['Product'] = $this->aProduct->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ProductDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setProductId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setChapo($value); - break; - case 6: - $this->setPostscriptum($value); - break; - case 7: - $this->setCreatedAt($value); - break; - case 8: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = ProductDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setProductId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setPostscriptum($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(ProductDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(ProductDescPeer::ID)) $criteria->add(ProductDescPeer::ID, $this->id); - if ($this->isColumnModified(ProductDescPeer::PRODUCT_ID)) $criteria->add(ProductDescPeer::PRODUCT_ID, $this->product_id); - if ($this->isColumnModified(ProductDescPeer::LANG)) $criteria->add(ProductDescPeer::LANG, $this->lang); - if ($this->isColumnModified(ProductDescPeer::TITLE)) $criteria->add(ProductDescPeer::TITLE, $this->title); - if ($this->isColumnModified(ProductDescPeer::DESCRIPTION)) $criteria->add(ProductDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(ProductDescPeer::CHAPO)) $criteria->add(ProductDescPeer::CHAPO, $this->chapo); - if ($this->isColumnModified(ProductDescPeer::POSTSCRIPTUM)) $criteria->add(ProductDescPeer::POSTSCRIPTUM, $this->postscriptum); - if ($this->isColumnModified(ProductDescPeer::CREATED_AT)) $criteria->add(ProductDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ProductDescPeer::UPDATED_AT)) $criteria->add(ProductDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(ProductDescPeer::DATABASE_NAME); - $criteria->add(ProductDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of ProductDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setProductId($this->getProductId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setChapo($this->getChapo()); - $copyObj->setPostscriptum($this->getPostscriptum()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return ProductDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ProductDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new ProductDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Product object. - * - * @param Product $v - * @return ProductDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setProduct(Product $v = null) - { - if ($v === null) { - $this->setProductId(NULL); - } else { - $this->setProductId($v->getId()); - } - - $this->aProduct = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Product object, it will not be re-added. - if ($v !== null) { - $v->addProductDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Product object - * - * @param PropelPDO $con Optional Connection object. - * @return Product The associated Product object. - * @throws PropelException - */ - public function getProduct(PropelPDO $con = null) - { - if ($this->aProduct === null && ($this->product_id !== null)) { - $this->aProduct = ProductQuery::create()->findPk($this->product_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aProduct->addProductDescs($this); - */ - } - - return $this->aProduct; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->product_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->chapo = null; - $this->postscriptum = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aProduct = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(ProductDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return ProductDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = ProductDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseProductDescPeer.php b/core/lib/Thelia/Model/om/BaseProductDescPeer.php deleted file mode 100644 index 6c76dfd28..000000000 --- a/core/lib/Thelia/Model/om/BaseProductDescPeer.php +++ /dev/null @@ -1,1042 +0,0 @@ - array ('Id', 'ProductId', 'Lang', 'Title', 'Description', 'Chapo', 'Postscriptum', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'productId', 'lang', 'title', 'description', 'chapo', 'postscriptum', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (ProductDescPeer::ID, ProductDescPeer::PRODUCT_ID, ProductDescPeer::LANG, ProductDescPeer::TITLE, ProductDescPeer::DESCRIPTION, ProductDescPeer::CHAPO, ProductDescPeer::POSTSCRIPTUM, ProductDescPeer::CREATED_AT, ProductDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PRODUCT_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'product_id', 'lang', 'title', 'description', 'chapo', 'postscriptum', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. ProductDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'ProductId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'Postscriptum' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'productId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'postscriptum' => 6, 'createdAt' => 7, 'updatedAt' => 8, ), - BasePeer::TYPE_COLNAME => array (ProductDescPeer::ID => 0, ProductDescPeer::PRODUCT_ID => 1, ProductDescPeer::LANG => 2, ProductDescPeer::TITLE => 3, ProductDescPeer::DESCRIPTION => 4, ProductDescPeer::CHAPO => 5, ProductDescPeer::POSTSCRIPTUM => 6, ProductDescPeer::CREATED_AT => 7, ProductDescPeer::UPDATED_AT => 8, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PRODUCT_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'POSTSCRIPTUM' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'product_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'postscriptum' => 6, 'created_at' => 7, 'updated_at' => 8, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = ProductDescPeer::getFieldNames($toType); - $key = isset(ProductDescPeer::$fieldKeys[$fromType][$name]) ? ProductDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ProductDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, ProductDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return ProductDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ProductDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(ProductDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(ProductDescPeer::ID); - $criteria->addSelectColumn(ProductDescPeer::PRODUCT_ID); - $criteria->addSelectColumn(ProductDescPeer::LANG); - $criteria->addSelectColumn(ProductDescPeer::TITLE); - $criteria->addSelectColumn(ProductDescPeer::DESCRIPTION); - $criteria->addSelectColumn(ProductDescPeer::CHAPO); - $criteria->addSelectColumn(ProductDescPeer::POSTSCRIPTUM); - $criteria->addSelectColumn(ProductDescPeer::CREATED_AT); - $criteria->addSelectColumn(ProductDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.PRODUCT_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CHAPO'); - $criteria->addSelectColumn($alias . '.POSTSCRIPTUM'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ProductDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ProductDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(ProductDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return ProductDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = ProductDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return ProductDescPeer::populateObjects(ProductDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - ProductDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(ProductDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param ProductDesc $obj A ProductDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - ProductDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A ProductDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof ProductDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ProductDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(ProductDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return ProductDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(ProductDescPeer::$instances[$key])) { - return ProductDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - ProductDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to product_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = ProductDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = ProductDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = ProductDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - ProductDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (ProductDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = ProductDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = ProductDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + ProductDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = ProductDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - ProductDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Product table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ProductDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ProductDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ProductDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ProductDescPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of ProductDesc objects pre-filled with their Product objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ProductDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ProductDescPeer::DATABASE_NAME); - } - - ProductDescPeer::addSelectColumns($criteria); - $startcol = ProductDescPeer::NUM_HYDRATE_COLUMNS; - ProductPeer::addSelectColumns($criteria); - - $criteria->addJoin(ProductDescPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ProductDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ProductDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = ProductDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ProductDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = ProductPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ProductPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - ProductPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (ProductDesc) to $obj2 (Product) - $obj2->addProductDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ProductDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ProductDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ProductDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ProductDescPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of ProductDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ProductDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ProductDescPeer::DATABASE_NAME); - } - - ProductDescPeer::addSelectColumns($criteria); - $startcol2 = ProductDescPeer::NUM_HYDRATE_COLUMNS; - - ProductPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(ProductDescPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ProductDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ProductDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = ProductDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ProductDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Product rows - - $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = ProductPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ProductPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - ProductPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (ProductDesc) to the collection in $obj2 (Product) - $obj2->addProductDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(ProductDescPeer::DATABASE_NAME)->getTable(ProductDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseProductDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseProductDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new ProductDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return ProductDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a ProductDesc or Criteria object. - * - * @param mixed $values Criteria or ProductDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from ProductDesc object - } - - if ($criteria->containsKey(ProductDescPeer::ID) && $criteria->keyContainsValue(ProductDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ProductDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(ProductDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a ProductDesc or Criteria object. - * - * @param mixed $values Criteria or ProductDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(ProductDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(ProductDescPeer::ID); - $value = $criteria->remove(ProductDescPeer::ID); - if ($value) { - $selectCriteria->add(ProductDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(ProductDescPeer::TABLE_NAME); - } - - } else { // $values is ProductDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(ProductDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the product_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(ProductDescPeer::TABLE_NAME, $con, ProductDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - ProductDescPeer::clearInstancePool(); - ProductDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a ProductDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or ProductDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - ProductDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof ProductDesc) { // it's a model object - // invalidate the cache for this single object - ProductDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(ProductDescPeer::DATABASE_NAME); - $criteria->add(ProductDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - ProductDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(ProductDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - ProductDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given ProductDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param ProductDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(ProductDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(ProductDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(ProductDescPeer::DATABASE_NAME, ProductDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return ProductDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = ProductDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(ProductDescPeer::DATABASE_NAME); - $criteria->add(ProductDescPeer::ID, $pk); - - $v = ProductDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return ProductDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(ProductDescPeer::DATABASE_NAME); - $criteria->add(ProductDescPeer::ID, $pks, Criteria::IN); - $objs = ProductDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseProductDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseProductDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseProductDescQuery.php b/core/lib/Thelia/Model/om/BaseProductDescQuery.php deleted file mode 100644 index 2fc764d64..000000000 --- a/core/lib/Thelia/Model/om/BaseProductDescQuery.php +++ /dev/null @@ -1,711 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return ProductDesc|ProductDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = ProductDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(ProductDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ProductDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `PRODUCT_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `CREATED_AT`, `UPDATED_AT` FROM `product_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new ProductDesc(); - $obj->hydrate($row); - ProductDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ProductDesc|ProductDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|ProductDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(ProductDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(ProductDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(ProductDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the product_id column - * - * Example usage: - * - * $query->filterByProductId(1234); // WHERE product_id = 1234 - * $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34) - * $query->filterByProductId(array('min' => 12)); // WHERE product_id > 12 - * - * - * @see filterByProduct() - * - * @param mixed $productId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterByProductId($productId = null, $comparison = null) - { - if (is_array($productId)) { - $useMinMax = false; - if (isset($productId['min'])) { - $this->addUsingAlias(ProductDescPeer::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($productId['max'])) { - $this->addUsingAlias(ProductDescPeer::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ProductDescPeer::PRODUCT_ID, $productId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ProductDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ProductDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ProductDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the chapo column - * - * Example usage: - * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' - * - * - * @param string $chapo The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterByChapo($chapo = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chapo)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ProductDescPeer::CHAPO, $chapo, $comparison); - } - - /** - * Filter the query on the postscriptum column - * - * Example usage: - * - * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue' - * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%' - * - * - * @param string $postscriptum The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterByPostscriptum($postscriptum = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($postscriptum)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $postscriptum)) { - $postscriptum = str_replace('*', '%', $postscriptum); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ProductDescPeer::POSTSCRIPTUM, $postscriptum, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(ProductDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(ProductDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ProductDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(ProductDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(ProductDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ProductDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Product object - * - * @param Product|PropelObjectCollection $product The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ProductDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByProduct($product, $comparison = null) - { - if ($product instanceof Product) { - return $this - ->addUsingAlias(ProductDescPeer::PRODUCT_ID, $product->getId(), $comparison); - } elseif ($product instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(ProductDescPeer::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByProduct() only accepts arguments of type Product or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Product relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Product'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Product'); - } - - return $this; - } - - /** - * Use the Product relation Product object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query - */ - public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinProduct($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery'); - } - - /** - * Exclude object from result - * - * @param ProductDesc $productDesc Object to remove from the list of results - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function prune($productDesc = null) - { - if ($productDesc) { - $this->addUsingAlias(ProductDescPeer::ID, $productDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(ProductDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(ProductDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(ProductDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(ProductDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(ProductDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return ProductDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(ProductDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseResourceDesc.php b/core/lib/Thelia/Model/om/BaseResourceDesc.php deleted file mode 100644 index 93211676a..000000000 --- a/core/lib/Thelia/Model/om/BaseResourceDesc.php +++ /dev/null @@ -1,1235 +0,0 @@ -id; - } - - /** - * Get the [resource_id] column value. - * - * @return int - */ - public function getResourceId() - { - return $this->resource_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return ResourceDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = ResourceDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [resource_id] column. - * - * @param int $v new value - * @return ResourceDesc The current object (for fluent API support) - */ - public function setResourceId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->resource_id !== $v) { - $this->resource_id = $v; - $this->modifiedColumns[] = ResourceDescPeer::RESOURCE_ID; - } - - if ($this->aResource !== null && $this->aResource->getId() !== $v) { - $this->aResource = null; - } - - - return $this; - } // setResourceId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return ResourceDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = ResourceDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return ResourceDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = ResourceDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ResourceDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = ResourceDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return ResourceDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = ResourceDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->resource_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->created_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->updated_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 6; // 6 = ResourceDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating ResourceDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aResource !== null && $this->resource_id !== $this->aResource->getId()) { - $this->aResource = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = ResourceDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aResource = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = ResourceDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(ResourceDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(ResourceDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ResourceDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - ResourceDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aResource !== null) { - if ($this->aResource->isModified() || $this->aResource->isNew()) { - $affectedRows += $this->aResource->save($con); - } - $this->setResource($this->aResource); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = ResourceDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ResourceDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ResourceDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(ResourceDescPeer::RESOURCE_ID)) { - $modifiedColumns[':p' . $index++] = '`RESOURCE_ID`'; - } - if ($this->isColumnModified(ResourceDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(ResourceDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(ResourceDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(ResourceDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `resource_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`RESOURCE_ID`': - $stmt->bindValue($identifier, $this->resource_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aResource !== null) { - if (!$this->aResource->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aResource->getValidationFailures()); - } - } - - - if (($retval = ResourceDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ResourceDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getResourceId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getCreatedAt(); - break; - case 5: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['ResourceDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['ResourceDesc'][$this->getPrimaryKey()] = true; - $keys = ResourceDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getResourceId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aResource) { - $result['Resource'] = $this->aResource->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ResourceDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setResourceId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setCreatedAt($value); - break; - case 5: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = ResourceDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setResourceId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(ResourceDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(ResourceDescPeer::ID)) $criteria->add(ResourceDescPeer::ID, $this->id); - if ($this->isColumnModified(ResourceDescPeer::RESOURCE_ID)) $criteria->add(ResourceDescPeer::RESOURCE_ID, $this->resource_id); - if ($this->isColumnModified(ResourceDescPeer::LANG)) $criteria->add(ResourceDescPeer::LANG, $this->lang); - if ($this->isColumnModified(ResourceDescPeer::TITLE)) $criteria->add(ResourceDescPeer::TITLE, $this->title); - if ($this->isColumnModified(ResourceDescPeer::CREATED_AT)) $criteria->add(ResourceDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ResourceDescPeer::UPDATED_AT)) $criteria->add(ResourceDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(ResourceDescPeer::DATABASE_NAME); - $criteria->add(ResourceDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of ResourceDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setResourceId($this->getResourceId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return ResourceDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ResourceDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new ResourceDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Resource object. - * - * @param Resource $v - * @return ResourceDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setResource(Resource $v = null) - { - if ($v === null) { - $this->setResourceId(NULL); - } else { - $this->setResourceId($v->getId()); - } - - $this->aResource = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Resource object, it will not be re-added. - if ($v !== null) { - $v->addResourceDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Resource object - * - * @param PropelPDO $con Optional Connection object. - * @return Resource The associated Resource object. - * @throws PropelException - */ - public function getResource(PropelPDO $con = null) - { - if ($this->aResource === null && ($this->resource_id !== null)) { - $this->aResource = ResourceQuery::create()->findPk($this->resource_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aResource->addResourceDescs($this); - */ - } - - return $this->aResource; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->resource_id = null; - $this->lang = null; - $this->title = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aResource = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(ResourceDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return ResourceDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = ResourceDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseResourceDescPeer.php b/core/lib/Thelia/Model/om/BaseResourceDescPeer.php deleted file mode 100644 index 1c2095508..000000000 --- a/core/lib/Thelia/Model/om/BaseResourceDescPeer.php +++ /dev/null @@ -1,1027 +0,0 @@ - array ('Id', 'ResourceId', 'Lang', 'Title', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'resourceId', 'lang', 'title', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (ResourceDescPeer::ID, ResourceDescPeer::RESOURCE_ID, ResourceDescPeer::LANG, ResourceDescPeer::TITLE, ResourceDescPeer::CREATED_AT, ResourceDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'RESOURCE_ID', 'LANG', 'TITLE', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'resource_id', 'lang', 'title', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. ResourceDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'ResourceId' => 1, 'Lang' => 2, 'Title' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'resourceId' => 1, 'lang' => 2, 'title' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), - BasePeer::TYPE_COLNAME => array (ResourceDescPeer::ID => 0, ResourceDescPeer::RESOURCE_ID => 1, ResourceDescPeer::LANG => 2, ResourceDescPeer::TITLE => 3, ResourceDescPeer::CREATED_AT => 4, ResourceDescPeer::UPDATED_AT => 5, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'RESOURCE_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'resource_id' => 1, 'lang' => 2, 'title' => 3, 'created_at' => 4, 'updated_at' => 5, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = ResourceDescPeer::getFieldNames($toType); - $key = isset(ResourceDescPeer::$fieldKeys[$fromType][$name]) ? ResourceDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ResourceDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, ResourceDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return ResourceDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ResourceDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(ResourceDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(ResourceDescPeer::ID); - $criteria->addSelectColumn(ResourceDescPeer::RESOURCE_ID); - $criteria->addSelectColumn(ResourceDescPeer::LANG); - $criteria->addSelectColumn(ResourceDescPeer::TITLE); - $criteria->addSelectColumn(ResourceDescPeer::CREATED_AT); - $criteria->addSelectColumn(ResourceDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.RESOURCE_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ResourceDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ResourceDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(ResourceDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return ResourceDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = ResourceDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return ResourceDescPeer::populateObjects(ResourceDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - ResourceDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(ResourceDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param ResourceDesc $obj A ResourceDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - ResourceDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A ResourceDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof ResourceDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ResourceDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(ResourceDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return ResourceDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(ResourceDescPeer::$instances[$key])) { - return ResourceDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - ResourceDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to resource_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = ResourceDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = ResourceDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = ResourceDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - ResourceDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (ResourceDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = ResourceDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = ResourceDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + ResourceDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = ResourceDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - ResourceDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Resource table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinResource(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ResourceDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ResourceDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ResourceDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ResourceDescPeer::RESOURCE_ID, ResourcePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of ResourceDesc objects pre-filled with their Resource objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ResourceDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinResource(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ResourceDescPeer::DATABASE_NAME); - } - - ResourceDescPeer::addSelectColumns($criteria); - $startcol = ResourceDescPeer::NUM_HYDRATE_COLUMNS; - ResourcePeer::addSelectColumns($criteria); - - $criteria->addJoin(ResourceDescPeer::RESOURCE_ID, ResourcePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ResourceDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ResourceDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = ResourceDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ResourceDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = ResourcePeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = ResourcePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ResourcePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - ResourcePeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (ResourceDesc) to $obj2 (Resource) - $obj2->addResourceDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ResourceDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ResourceDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ResourceDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ResourceDescPeer::RESOURCE_ID, ResourcePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of ResourceDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ResourceDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ResourceDescPeer::DATABASE_NAME); - } - - ResourceDescPeer::addSelectColumns($criteria); - $startcol2 = ResourceDescPeer::NUM_HYDRATE_COLUMNS; - - ResourcePeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + ResourcePeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(ResourceDescPeer::RESOURCE_ID, ResourcePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ResourceDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ResourceDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = ResourceDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ResourceDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Resource rows - - $key2 = ResourcePeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = ResourcePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = ResourcePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - ResourcePeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (ResourceDesc) to the collection in $obj2 (Resource) - $obj2->addResourceDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(ResourceDescPeer::DATABASE_NAME)->getTable(ResourceDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseResourceDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseResourceDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new ResourceDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return ResourceDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a ResourceDesc or Criteria object. - * - * @param mixed $values Criteria or ResourceDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from ResourceDesc object - } - - if ($criteria->containsKey(ResourceDescPeer::ID) && $criteria->keyContainsValue(ResourceDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ResourceDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(ResourceDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a ResourceDesc or Criteria object. - * - * @param mixed $values Criteria or ResourceDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(ResourceDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(ResourceDescPeer::ID); - $value = $criteria->remove(ResourceDescPeer::ID); - if ($value) { - $selectCriteria->add(ResourceDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(ResourceDescPeer::TABLE_NAME); - } - - } else { // $values is ResourceDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(ResourceDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the resource_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(ResourceDescPeer::TABLE_NAME, $con, ResourceDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - ResourceDescPeer::clearInstancePool(); - ResourceDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a ResourceDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or ResourceDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - ResourceDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof ResourceDesc) { // it's a model object - // invalidate the cache for this single object - ResourceDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(ResourceDescPeer::DATABASE_NAME); - $criteria->add(ResourceDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - ResourceDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(ResourceDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - ResourceDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given ResourceDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param ResourceDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(ResourceDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(ResourceDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(ResourceDescPeer::DATABASE_NAME, ResourceDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return ResourceDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = ResourceDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(ResourceDescPeer::DATABASE_NAME); - $criteria->add(ResourceDescPeer::ID, $pk); - - $v = ResourceDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return ResourceDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(ResourceDescPeer::DATABASE_NAME); - $criteria->add(ResourceDescPeer::ID, $pks, Criteria::IN); - $objs = ResourceDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseResourceDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseResourceDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseResourceDescQuery.php b/core/lib/Thelia/Model/om/BaseResourceDescQuery.php deleted file mode 100644 index 8099a73a4..000000000 --- a/core/lib/Thelia/Model/om/BaseResourceDescQuery.php +++ /dev/null @@ -1,612 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return ResourceDesc|ResourceDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = ResourceDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(ResourceDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ResourceDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `RESOURCE_ID`, `LANG`, `TITLE`, `CREATED_AT`, `UPDATED_AT` FROM `resource_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new ResourceDesc(); - $obj->hydrate($row); - ResourceDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return ResourceDesc|ResourceDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|ResourceDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(ResourceDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(ResourceDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(ResourceDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the resource_id column - * - * Example usage: - * - * $query->filterByResourceId(1234); // WHERE resource_id = 1234 - * $query->filterByResourceId(array(12, 34)); // WHERE resource_id IN (12, 34) - * $query->filterByResourceId(array('min' => 12)); // WHERE resource_id > 12 - * - * - * @see filterByResource() - * - * @param mixed $resourceId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function filterByResourceId($resourceId = null, $comparison = null) - { - if (is_array($resourceId)) { - $useMinMax = false; - if (isset($resourceId['min'])) { - $this->addUsingAlias(ResourceDescPeer::RESOURCE_ID, $resourceId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($resourceId['max'])) { - $this->addUsingAlias(ResourceDescPeer::RESOURCE_ID, $resourceId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ResourceDescPeer::RESOURCE_ID, $resourceId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ResourceDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ResourceDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(ResourceDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(ResourceDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ResourceDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(ResourceDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(ResourceDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ResourceDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Resource object - * - * @param Resource|PropelObjectCollection $resource The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ResourceDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByResource($resource, $comparison = null) - { - if ($resource instanceof Resource) { - return $this - ->addUsingAlias(ResourceDescPeer::RESOURCE_ID, $resource->getId(), $comparison); - } elseif ($resource instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(ResourceDescPeer::RESOURCE_ID, $resource->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByResource() only accepts arguments of type Resource or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Resource relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function joinResource($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Resource'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Resource'); - } - - return $this; - } - - /** - * Use the Resource relation Resource object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ResourceQuery A secondary query class using the current class as primary query - */ - public function useResourceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinResource($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Resource', '\Thelia\Model\ResourceQuery'); - } - - /** - * Exclude object from result - * - * @param ResourceDesc $resourceDesc Object to remove from the list of results - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function prune($resourceDesc = null) - { - if ($resourceDesc) { - $this->addUsingAlias(ResourceDescPeer::ID, $resourceDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(ResourceDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(ResourceDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(ResourceDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(ResourceDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(ResourceDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return ResourceDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(ResourceDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseTaxDesc.php b/core/lib/Thelia/Model/om/BaseTaxDesc.php deleted file mode 100644 index ab5544556..000000000 --- a/core/lib/Thelia/Model/om/BaseTaxDesc.php +++ /dev/null @@ -1,1290 +0,0 @@ -id; - } - - /** - * Get the [tax_id] column value. - * - * @return int - */ - public function getTaxId() - { - return $this->tax_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return TaxDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = TaxDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [tax_id] column. - * - * @param int $v new value - * @return TaxDesc The current object (for fluent API support) - */ - public function setTaxId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->tax_id !== $v) { - $this->tax_id = $v; - $this->modifiedColumns[] = TaxDescPeer::TAX_ID; - } - - if ($this->aTax !== null && $this->aTax->getId() !== $v) { - $this->aTax = null; - } - - - return $this; - } // setTaxId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return TaxDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = TaxDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return TaxDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = TaxDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return TaxDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = TaxDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return TaxDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = TaxDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return TaxDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = TaxDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->tax_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->created_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->updated_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 7; // 7 = TaxDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating TaxDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aTax !== null && $this->tax_id !== $this->aTax->getId()) { - $this->aTax = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = TaxDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aTax = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = TaxDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(TaxDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(TaxDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(TaxDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - TaxDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aTax !== null) { - if ($this->aTax->isModified() || $this->aTax->isNew()) { - $affectedRows += $this->aTax->save($con); - } - $this->setTax($this->aTax); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = TaxDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . TaxDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(TaxDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(TaxDescPeer::TAX_ID)) { - $modifiedColumns[':p' . $index++] = '`TAX_ID`'; - } - if ($this->isColumnModified(TaxDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(TaxDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(TaxDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(TaxDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(TaxDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `tax_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`TAX_ID`': - $stmt->bindValue($identifier, $this->tax_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aTax !== null) { - if (!$this->aTax->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aTax->getValidationFailures()); - } - } - - - if (($retval = TaxDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = TaxDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getTaxId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getCreatedAt(); - break; - case 6: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['TaxDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['TaxDesc'][$this->getPrimaryKey()] = true; - $keys = TaxDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getTaxId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getCreatedAt(), - $keys[6] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aTax) { - $result['Tax'] = $this->aTax->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = TaxDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setTaxId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setCreatedAt($value); - break; - case 6: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = TaxDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setTaxId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(TaxDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(TaxDescPeer::ID)) $criteria->add(TaxDescPeer::ID, $this->id); - if ($this->isColumnModified(TaxDescPeer::TAX_ID)) $criteria->add(TaxDescPeer::TAX_ID, $this->tax_id); - if ($this->isColumnModified(TaxDescPeer::LANG)) $criteria->add(TaxDescPeer::LANG, $this->lang); - if ($this->isColumnModified(TaxDescPeer::TITLE)) $criteria->add(TaxDescPeer::TITLE, $this->title); - if ($this->isColumnModified(TaxDescPeer::DESCRIPTION)) $criteria->add(TaxDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(TaxDescPeer::CREATED_AT)) $criteria->add(TaxDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(TaxDescPeer::UPDATED_AT)) $criteria->add(TaxDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(TaxDescPeer::DATABASE_NAME); - $criteria->add(TaxDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of TaxDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setTaxId($this->getTaxId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return TaxDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return TaxDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new TaxDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Tax object. - * - * @param Tax $v - * @return TaxDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setTax(Tax $v = null) - { - if ($v === null) { - $this->setTaxId(NULL); - } else { - $this->setTaxId($v->getId()); - } - - $this->aTax = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Tax object, it will not be re-added. - if ($v !== null) { - $v->addTaxDesc($this); - } - - - return $this; - } - - - /** - * Get the associated Tax object - * - * @param PropelPDO $con Optional Connection object. - * @return Tax The associated Tax object. - * @throws PropelException - */ - public function getTax(PropelPDO $con = null) - { - if ($this->aTax === null && ($this->tax_id !== null)) { - $this->aTax = TaxQuery::create()->findPk($this->tax_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aTax->addTaxDescs($this); - */ - } - - return $this->aTax; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->tax_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aTax = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(TaxDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return TaxDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = TaxDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseTaxDescPeer.php b/core/lib/Thelia/Model/om/BaseTaxDescPeer.php deleted file mode 100644 index aecfb3a76..000000000 --- a/core/lib/Thelia/Model/om/BaseTaxDescPeer.php +++ /dev/null @@ -1,1032 +0,0 @@ - array ('Id', 'TaxId', 'Lang', 'Title', 'Description', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'taxId', 'lang', 'title', 'description', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (TaxDescPeer::ID, TaxDescPeer::TAX_ID, TaxDescPeer::LANG, TaxDescPeer::TITLE, TaxDescPeer::DESCRIPTION, TaxDescPeer::CREATED_AT, TaxDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAX_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'tax_id', 'lang', 'title', 'description', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. TaxDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'TaxId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'taxId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - BasePeer::TYPE_COLNAME => array (TaxDescPeer::ID => 0, TaxDescPeer::TAX_ID => 1, TaxDescPeer::LANG => 2, TaxDescPeer::TITLE => 3, TaxDescPeer::DESCRIPTION => 4, TaxDescPeer::CREATED_AT => 5, TaxDescPeer::UPDATED_AT => 6, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAX_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tax_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'created_at' => 5, 'updated_at' => 6, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = TaxDescPeer::getFieldNames($toType); - $key = isset(TaxDescPeer::$fieldKeys[$fromType][$name]) ? TaxDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(TaxDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, TaxDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return TaxDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. TaxDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(TaxDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(TaxDescPeer::ID); - $criteria->addSelectColumn(TaxDescPeer::TAX_ID); - $criteria->addSelectColumn(TaxDescPeer::LANG); - $criteria->addSelectColumn(TaxDescPeer::TITLE); - $criteria->addSelectColumn(TaxDescPeer::DESCRIPTION); - $criteria->addSelectColumn(TaxDescPeer::CREATED_AT); - $criteria->addSelectColumn(TaxDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.TAX_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(TaxDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - TaxDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(TaxDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return TaxDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = TaxDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return TaxDescPeer::populateObjects(TaxDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - TaxDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(TaxDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param TaxDesc $obj A TaxDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - TaxDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A TaxDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof TaxDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or TaxDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(TaxDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return TaxDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(TaxDescPeer::$instances[$key])) { - return TaxDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - TaxDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to tax_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = TaxDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = TaxDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = TaxDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - TaxDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (TaxDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = TaxDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = TaxDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + TaxDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = TaxDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - TaxDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Tax table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinTax(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(TaxDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - TaxDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(TaxDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(TaxDescPeer::TAX_ID, TaxPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of TaxDesc objects pre-filled with their Tax objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of TaxDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinTax(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(TaxDescPeer::DATABASE_NAME); - } - - TaxDescPeer::addSelectColumns($criteria); - $startcol = TaxDescPeer::NUM_HYDRATE_COLUMNS; - TaxPeer::addSelectColumns($criteria); - - $criteria->addJoin(TaxDescPeer::TAX_ID, TaxPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = TaxDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = TaxDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = TaxDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - TaxDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = TaxPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = TaxPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - TaxPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (TaxDesc) to $obj2 (Tax) - $obj2->addTaxDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(TaxDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - TaxDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(TaxDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(TaxDescPeer::TAX_ID, TaxPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of TaxDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of TaxDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(TaxDescPeer::DATABASE_NAME); - } - - TaxDescPeer::addSelectColumns($criteria); - $startcol2 = TaxDescPeer::NUM_HYDRATE_COLUMNS; - - TaxPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + TaxPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(TaxDescPeer::TAX_ID, TaxPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = TaxDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = TaxDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = TaxDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - TaxDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Tax rows - - $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = TaxPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = TaxPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - TaxPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (TaxDesc) to the collection in $obj2 (Tax) - $obj2->addTaxDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(TaxDescPeer::DATABASE_NAME)->getTable(TaxDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseTaxDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseTaxDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new TaxDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return TaxDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a TaxDesc or Criteria object. - * - * @param mixed $values Criteria or TaxDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from TaxDesc object - } - - if ($criteria->containsKey(TaxDescPeer::ID) && $criteria->keyContainsValue(TaxDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.TaxDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(TaxDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a TaxDesc or Criteria object. - * - * @param mixed $values Criteria or TaxDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(TaxDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(TaxDescPeer::ID); - $value = $criteria->remove(TaxDescPeer::ID); - if ($value) { - $selectCriteria->add(TaxDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(TaxDescPeer::TABLE_NAME); - } - - } else { // $values is TaxDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(TaxDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the tax_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(TaxDescPeer::TABLE_NAME, $con, TaxDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - TaxDescPeer::clearInstancePool(); - TaxDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a TaxDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or TaxDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - TaxDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof TaxDesc) { // it's a model object - // invalidate the cache for this single object - TaxDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(TaxDescPeer::DATABASE_NAME); - $criteria->add(TaxDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - TaxDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(TaxDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - TaxDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given TaxDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param TaxDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(TaxDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(TaxDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(TaxDescPeer::DATABASE_NAME, TaxDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return TaxDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = TaxDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(TaxDescPeer::DATABASE_NAME); - $criteria->add(TaxDescPeer::ID, $pk); - - $v = TaxDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return TaxDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(TaxDescPeer::DATABASE_NAME); - $criteria->add(TaxDescPeer::ID, $pks, Criteria::IN); - $objs = TaxDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseTaxDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseTaxDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseTaxDescQuery.php b/core/lib/Thelia/Model/om/BaseTaxDescQuery.php deleted file mode 100644 index b737bf264..000000000 --- a/core/lib/Thelia/Model/om/BaseTaxDescQuery.php +++ /dev/null @@ -1,645 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return TaxDesc|TaxDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = TaxDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(TaxDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return TaxDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `TAX_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CREATED_AT`, `UPDATED_AT` FROM `tax_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new TaxDesc(); - $obj->hydrate($row); - TaxDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return TaxDesc|TaxDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|TaxDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(TaxDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(TaxDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(TaxDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the tax_id column - * - * Example usage: - * - * $query->filterByTaxId(1234); // WHERE tax_id = 1234 - * $query->filterByTaxId(array(12, 34)); // WHERE tax_id IN (12, 34) - * $query->filterByTaxId(array('min' => 12)); // WHERE tax_id > 12 - * - * - * @see filterByTax() - * - * @param mixed $taxId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function filterByTaxId($taxId = null, $comparison = null) - { - if (is_array($taxId)) { - $useMinMax = false; - if (isset($taxId['min'])) { - $this->addUsingAlias(TaxDescPeer::TAX_ID, $taxId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($taxId['max'])) { - $this->addUsingAlias(TaxDescPeer::TAX_ID, $taxId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(TaxDescPeer::TAX_ID, $taxId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(TaxDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(TaxDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(TaxDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(TaxDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(TaxDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(TaxDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(TaxDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(TaxDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(TaxDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Tax object - * - * @param Tax|PropelObjectCollection $tax The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByTax($tax, $comparison = null) - { - if ($tax instanceof Tax) { - return $this - ->addUsingAlias(TaxDescPeer::TAX_ID, $tax->getId(), $comparison); - } elseif ($tax instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(TaxDescPeer::TAX_ID, $tax->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByTax() only accepts arguments of type Tax or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Tax relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function joinTax($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Tax'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Tax'); - } - - return $this; - } - - /** - * Use the Tax relation Tax object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\TaxQuery A secondary query class using the current class as primary query - */ - public function useTaxQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinTax($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Tax', '\Thelia\Model\TaxQuery'); - } - - /** - * Exclude object from result - * - * @param TaxDesc $taxDesc Object to remove from the list of results - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function prune($taxDesc = null) - { - if ($taxDesc) { - $this->addUsingAlias(TaxDescPeer::ID, $taxDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(TaxDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(TaxDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(TaxDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(TaxDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(TaxDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return TaxDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(TaxDescPeer::CREATED_AT); - } -} diff --git a/core/lib/Thelia/Model/om/BaseTaxRuleDesc.php b/core/lib/Thelia/Model/om/BaseTaxRuleDesc.php deleted file mode 100644 index d5debaafb..000000000 --- a/core/lib/Thelia/Model/om/BaseTaxRuleDesc.php +++ /dev/null @@ -1,1290 +0,0 @@ -id; - } - - /** - * Get the [tax_rule_id] column value. - * - * @return int - */ - public function getTaxRuleId() - { - return $this->tax_rule_id; - } - - /** - * Get the [lang] column value. - * - * @return string - */ - public function getLang() - { - return $this->lang; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Get the [optionally formatted] temporal [created_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCreatedAt($format = 'Y-m-d H:i:s') - { - if ($this->created_at === null) { - return null; - } - - if ($this->created_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [updated_at] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is null, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getUpdatedAt($format = 'Y-m-d H:i:s') - { - if ($this->updated_at === null) { - return null; - } - - if ($this->updated_at === '0000-00-00 00:00:00') { - // while technically this is not a default value of null, - // this seems to be closest in meaning. - return null; - } else { - try { - $dt = new DateTime($this->updated_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x); - } - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return TaxRuleDesc The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = TaxRuleDescPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [tax_rule_id] column. - * - * @param int $v new value - * @return TaxRuleDesc The current object (for fluent API support) - */ - public function setTaxRuleId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->tax_rule_id !== $v) { - $this->tax_rule_id = $v; - $this->modifiedColumns[] = TaxRuleDescPeer::TAX_RULE_ID; - } - - if ($this->aTaxRule !== null && $this->aTaxRule->getId() !== $v) { - $this->aTaxRule = null; - } - - - return $this; - } // setTaxRuleId() - - /** - * Set the value of [lang] column. - * - * @param string $v new value - * @return TaxRuleDesc The current object (for fluent API support) - */ - public function setLang($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lang !== $v) { - $this->lang = $v; - $this->modifiedColumns[] = TaxRuleDescPeer::LANG; - } - - - return $this; - } // setLang() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return TaxRuleDesc The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = TaxRuleDescPeer::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return TaxRuleDesc The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = TaxRuleDescPeer::DESCRIPTION; - } - - - return $this; - } // setDescription() - - /** - * Sets the value of [created_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return TaxRuleDesc The current object (for fluent API support) - */ - public function setCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->created_at !== null || $dt !== null) { - $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->created_at = $newDateAsString; - $this->modifiedColumns[] = TaxRuleDescPeer::CREATED_AT; - } - } // if either are not null - - - return $this; - } // setCreatedAt() - - /** - * Sets the value of [updated_at] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. - * Empty strings are treated as null. - * @return TaxRuleDesc The current object (for fluent API support) - */ - public function setUpdatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->updated_at !== null || $dt !== null) { - $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null; - $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; - if ($currentDateAsString !== $newDateAsString) { - $this->updated_at = $newDateAsString; - $this->modifiedColumns[] = TaxRuleDescPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return true - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->tax_rule_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->created_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->updated_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 7; // 7 = TaxRuleDescPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating TaxRuleDesc object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aTaxRule !== null && $this->tax_rule_id !== $this->aTaxRule->getId()) { - $this->aTaxRule = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = TaxRuleDescPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aTaxRule = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @throws Exception - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = TaxRuleDescQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @throws Exception - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(TaxRuleDescPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(TaxRuleDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(TaxRuleDescPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - TaxRuleDescPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aTaxRule !== null) { - if ($this->aTaxRule->isModified() || $this->aTaxRule->isNew()) { - $affectedRows += $this->aTaxRule->save($con); - } - $this->setTaxRule($this->aTaxRule); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - $this->alreadyInSave = false; - - } - - return $affectedRows; - } // doSave() - - /** - * Insert the row in the database. - * - * @param PropelPDO $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(PropelPDO $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = TaxRuleDescPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . TaxRuleDescPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(TaxRuleDescPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`ID`'; - } - if ($this->isColumnModified(TaxRuleDescPeer::TAX_RULE_ID)) { - $modifiedColumns[':p' . $index++] = '`TAX_RULE_ID`'; - } - if ($this->isColumnModified(TaxRuleDescPeer::LANG)) { - $modifiedColumns[':p' . $index++] = '`LANG`'; - } - if ($this->isColumnModified(TaxRuleDescPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '`TITLE`'; - } - if ($this->isColumnModified(TaxRuleDescPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; - } - if ($this->isColumnModified(TaxRuleDescPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; - } - if ($this->isColumnModified(TaxRuleDescPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; - } - - $sql = sprintf( - 'INSERT INTO `tax_rule_desc` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`ID`': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '`TAX_RULE_ID`': - $stmt->bindValue($identifier, $this->tax_rule_id, PDO::PARAM_INT); - break; - case '`LANG`': - $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); - break; - case '`TITLE`': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '`DESCRIPTION`': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '`CREATED_AT`': - $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR); - break; - case '`UPDATED_AT`': - $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', $e); - } - $this->setId($pk); - - $this->setNew(false); - } - - /** - * Update the row in the database. - * - * @param PropelPDO $con - * - * @see doSave() - */ - protected function doUpdate(PropelPDO $con) - { - $selectCriteria = $this->buildPkeyCriteria(); - $valuesCriteria = $this->buildCriteria(); - BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); - } - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - - return true; - } else { - $this->validationFailures = $res; - - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aTaxRule !== null) { - if (!$this->aTaxRule->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aTaxRule->getValidationFailures()); - } - } - - - if (($retval = TaxRuleDescPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = TaxRuleDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch ($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getTaxRuleId(); - break; - case 2: - return $this->getLang(); - break; - case 3: - return $this->getTitle(); - break; - case 4: - return $this->getDescription(); - break; - case 5: - return $this->getCreatedAt(); - break; - case 6: - return $this->getUpdatedAt(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) - { - if (isset($alreadyDumpedObjects['TaxRuleDesc'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['TaxRuleDesc'][$this->getPrimaryKey()] = true; - $keys = TaxRuleDescPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getTaxRuleId(), - $keys[2] => $this->getLang(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), - $keys[5] => $this->getCreatedAt(), - $keys[6] => $this->getUpdatedAt(), - ); - if ($includeForeignObjects) { - if (null !== $this->aTaxRule) { - $result['TaxRule'] = $this->aTaxRule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - } - - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = TaxRuleDescPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - - $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch ($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setTaxRuleId($value); - break; - case 2: - $this->setLang($value); - break; - case 3: - $this->setTitle($value); - break; - case 4: - $this->setDescription($value); - break; - case 5: - $this->setCreatedAt($value); - break; - case 6: - $this->setUpdatedAt($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's BasePeer::TYPE_PHPNAME - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = TaxRuleDescPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setTaxRuleId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLang($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(TaxRuleDescPeer::DATABASE_NAME); - - if ($this->isColumnModified(TaxRuleDescPeer::ID)) $criteria->add(TaxRuleDescPeer::ID, $this->id); - if ($this->isColumnModified(TaxRuleDescPeer::TAX_RULE_ID)) $criteria->add(TaxRuleDescPeer::TAX_RULE_ID, $this->tax_rule_id); - if ($this->isColumnModified(TaxRuleDescPeer::LANG)) $criteria->add(TaxRuleDescPeer::LANG, $this->lang); - if ($this->isColumnModified(TaxRuleDescPeer::TITLE)) $criteria->add(TaxRuleDescPeer::TITLE, $this->title); - if ($this->isColumnModified(TaxRuleDescPeer::DESCRIPTION)) $criteria->add(TaxRuleDescPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(TaxRuleDescPeer::CREATED_AT)) $criteria->add(TaxRuleDescPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(TaxRuleDescPeer::UPDATED_AT)) $criteria->add(TaxRuleDescPeer::UPDATED_AT, $this->updated_at); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(TaxRuleDescPeer::DATABASE_NAME); - $criteria->add(TaxRuleDescPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of TaxRuleDesc (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) - { - $copyObj->setTaxRuleId($this->getTaxRuleId()); - $copyObj->setLang($this->getLang()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - - if ($deepCopy && !$this->startCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - // store object hash to prevent cycle - $this->startCopy = true; - - //unflag object copy - $this->startCopy = false; - } // if ($deepCopy) - - if ($makeNew) { - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return TaxRuleDesc Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return TaxRuleDescPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new TaxRuleDescPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a TaxRule object. - * - * @param TaxRule $v - * @return TaxRuleDesc The current object (for fluent API support) - * @throws PropelException - */ - public function setTaxRule(TaxRule $v = null) - { - if ($v === null) { - $this->setTaxRuleId(NULL); - } else { - $this->setTaxRuleId($v->getId()); - } - - $this->aTaxRule = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the TaxRule object, it will not be re-added. - if ($v !== null) { - $v->addTaxRuleDesc($this); - } - - - return $this; - } - - - /** - * Get the associated TaxRule object - * - * @param PropelPDO $con Optional Connection object. - * @return TaxRule The associated TaxRule object. - * @throws PropelException - */ - public function getTaxRule(PropelPDO $con = null) - { - if ($this->aTaxRule === null && ($this->tax_rule_id !== null)) { - $this->aTaxRule = TaxRuleQuery::create()->findPk($this->tax_rule_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aTaxRule->addTaxRuleDescs($this); - */ - } - - return $this->aTaxRule; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->tax_rule_id = null; - $this->lang = null; - $this->title = null; - $this->description = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all references to other model objects or collections of model objects. - * - * This method is a user-space workaround for PHP's inability to garbage collect - * objects with circular references (even in PHP 5.3). This is currently necessary - * when using Propel in certain daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aTaxRule = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(TaxRuleDescPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // timestampable behavior - - /** - * Mark the current object so that the update date doesn't get updated during next save - * - * @return TaxRuleDesc The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = TaxRuleDescPeer::UPDATED_AT; - - return $this; - } - -} diff --git a/core/lib/Thelia/Model/om/BaseTaxRuleDescPeer.php b/core/lib/Thelia/Model/om/BaseTaxRuleDescPeer.php deleted file mode 100644 index 6b7ff375d..000000000 --- a/core/lib/Thelia/Model/om/BaseTaxRuleDescPeer.php +++ /dev/null @@ -1,1032 +0,0 @@ - array ('Id', 'TaxRuleId', 'Lang', 'Title', 'Description', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'taxRuleId', 'lang', 'title', 'description', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (TaxRuleDescPeer::ID, TaxRuleDescPeer::TAX_RULE_ID, TaxRuleDescPeer::LANG, TaxRuleDescPeer::TITLE, TaxRuleDescPeer::DESCRIPTION, TaxRuleDescPeer::CREATED_AT, TaxRuleDescPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAX_RULE_ID', 'LANG', 'TITLE', 'DESCRIPTION', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'tax_rule_id', 'lang', 'title', 'description', 'created_at', 'updated_at', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. TaxRuleDescPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'TaxRuleId' => 1, 'Lang' => 2, 'Title' => 3, 'Description' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'taxRuleId' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - BasePeer::TYPE_COLNAME => array (TaxRuleDescPeer::ID => 0, TaxRuleDescPeer::TAX_RULE_ID => 1, TaxRuleDescPeer::LANG => 2, TaxRuleDescPeer::TITLE => 3, TaxRuleDescPeer::DESCRIPTION => 4, TaxRuleDescPeer::CREATED_AT => 5, TaxRuleDescPeer::UPDATED_AT => 6, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAX_RULE_ID' => 1, 'LANG' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tax_rule_id' => 1, 'lang' => 2, 'title' => 3, 'description' => 4, 'created_at' => 5, 'updated_at' => 6, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - public static function translateFieldName($name, $fromType, $toType) - { - $toNames = TaxRuleDescPeer::getFieldNames($toType); - $key = isset(TaxRuleDescPeer::$fieldKeys[$fromType][$name]) ? TaxRuleDescPeer::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(TaxRuleDescPeer::$fieldKeys[$fromType], true)); - } - - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - * @throws PropelException - if the type is not valid. - */ - public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, TaxRuleDescPeer::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - - return TaxRuleDescPeer::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. TaxRuleDescPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(TaxRuleDescPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(TaxRuleDescPeer::ID); - $criteria->addSelectColumn(TaxRuleDescPeer::TAX_RULE_ID); - $criteria->addSelectColumn(TaxRuleDescPeer::LANG); - $criteria->addSelectColumn(TaxRuleDescPeer::TITLE); - $criteria->addSelectColumn(TaxRuleDescPeer::DESCRIPTION); - $criteria->addSelectColumn(TaxRuleDescPeer::CREATED_AT); - $criteria->addSelectColumn(TaxRuleDescPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.TAX_RULE_ID'); - $criteria->addSelectColumn($alias . '.LANG'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.CREATED_AT'); - $criteria->addSelectColumn($alias . '.UPDATED_AT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(TaxRuleDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - TaxRuleDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(TaxRuleDescPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - /** - * Selects one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return TaxRuleDesc - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = TaxRuleDescPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - - return null; - } - /** - * Selects several row from the DB. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return TaxRuleDescPeer::populateObjects(TaxRuleDescPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - TaxRuleDescPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(TaxRuleDescPeer::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param TaxRuleDesc $obj A TaxRuleDesc object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool($obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - TaxRuleDescPeer::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A TaxRuleDesc object or a primary key value. - * - * @return void - * @throws PropelException - if the value is invalid. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof TaxRuleDesc) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or TaxRuleDesc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(TaxRuleDescPeer::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return TaxRuleDesc Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(TaxRuleDescPeer::$instances[$key])) { - return TaxRuleDescPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - TaxRuleDescPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to tax_rule_desc - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or null if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return null. - if ($row[$startcol] === null) { - return null; - } - - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = TaxRuleDescPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = TaxRuleDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = TaxRuleDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - TaxRuleDescPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (TaxRuleDesc object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = TaxRuleDescPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = TaxRuleDescPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + TaxRuleDescPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = TaxRuleDescPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - TaxRuleDescPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related TaxRule table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinTaxRule(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(TaxRuleDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - TaxRuleDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(TaxRuleDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(TaxRuleDescPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of TaxRuleDesc objects pre-filled with their TaxRule objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of TaxRuleDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinTaxRule(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(TaxRuleDescPeer::DATABASE_NAME); - } - - TaxRuleDescPeer::addSelectColumns($criteria); - $startcol = TaxRuleDescPeer::NUM_HYDRATE_COLUMNS; - TaxRulePeer::addSelectColumns($criteria); - - $criteria->addJoin(TaxRuleDescPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = TaxRuleDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = TaxRuleDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = TaxRuleDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - TaxRuleDescPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = TaxRulePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = TaxRulePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - TaxRulePeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (TaxRuleDesc) to $obj2 (TaxRule) - $obj2->addTaxRuleDesc($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(TaxRuleDescPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - TaxRuleDescPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(TaxRuleDescPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(TaxRuleDescPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - /** - * Selects a collection of TaxRuleDesc objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of TaxRuleDesc objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(TaxRuleDescPeer::DATABASE_NAME); - } - - TaxRuleDescPeer::addSelectColumns($criteria); - $startcol2 = TaxRuleDescPeer::NUM_HYDRATE_COLUMNS; - - TaxRulePeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + TaxRulePeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(TaxRuleDescPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = TaxRuleDescPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = TaxRuleDescPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = TaxRuleDescPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - TaxRuleDescPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined TaxRule rows - - $key2 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = TaxRulePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = TaxRulePeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - TaxRulePeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (TaxRuleDesc) to the collection in $obj2 (TaxRule) - $obj2->addTaxRuleDesc($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(TaxRuleDescPeer::DATABASE_NAME)->getTable(TaxRuleDescPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseTaxRuleDescPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseTaxRuleDescPeer::TABLE_NAME)) { - $dbMap->addTableObject(new TaxRuleDescTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass() - { - return TaxRuleDescPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a TaxRuleDesc or Criteria object. - * - * @param mixed $values Criteria or TaxRuleDesc object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from TaxRuleDesc object - } - - if ($criteria->containsKey(TaxRuleDescPeer::ID) && $criteria->keyContainsValue(TaxRuleDescPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.TaxRuleDescPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(TaxRuleDescPeer::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a TaxRuleDesc or Criteria object. - * - * @param mixed $values Criteria or TaxRuleDesc object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(TaxRuleDescPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(TaxRuleDescPeer::ID); - $value = $criteria->remove(TaxRuleDescPeer::ID); - if ($value) { - $selectCriteria->add(TaxRuleDescPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(TaxRuleDescPeer::TABLE_NAME); - } - - } else { // $values is TaxRuleDesc object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(TaxRuleDescPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the tax_rule_desc table. - * - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException - */ - public static function doDeleteAll(PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(TaxRuleDescPeer::TABLE_NAME, $con, TaxRuleDescPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - TaxRuleDescPeer::clearInstancePool(); - TaxRuleDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a TaxRuleDesc or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or TaxRuleDesc object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - TaxRuleDescPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof TaxRuleDesc) { // it's a model object - // invalidate the cache for this single object - TaxRuleDescPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(TaxRuleDescPeer::DATABASE_NAME); - $criteria->add(TaxRuleDescPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - TaxRuleDescPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(TaxRuleDescPeer::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - TaxRuleDescPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given TaxRuleDesc object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param TaxRuleDesc $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate($obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(TaxRuleDescPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(TaxRuleDescPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->hasColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(TaxRuleDescPeer::DATABASE_NAME, TaxRuleDescPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return TaxRuleDesc - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = TaxRuleDescPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(TaxRuleDescPeer::DATABASE_NAME); - $criteria->add(TaxRuleDescPeer::ID, $pk); - - $v = TaxRuleDescPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @return TaxRuleDesc[] - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(TaxRuleDescPeer::DATABASE_NAME); - $criteria->add(TaxRuleDescPeer::ID, $pks, Criteria::IN); - $objs = TaxRuleDescPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseTaxRuleDescPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseTaxRuleDescPeer::buildTableMap(); - diff --git a/core/lib/Thelia/Model/om/BaseTaxRuleDescQuery.php b/core/lib/Thelia/Model/om/BaseTaxRuleDescQuery.php deleted file mode 100644 index 2e0f8d413..000000000 --- a/core/lib/Thelia/Model/om/BaseTaxRuleDescQuery.php +++ /dev/null @@ -1,645 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return TaxRuleDesc|TaxRuleDesc[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = TaxRuleDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is alredy in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(TaxRuleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return TaxRuleDesc A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `ID`, `TAX_RULE_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CREATED_AT`, `UPDATED_AT` FROM `tax_rule_desc` WHERE `ID` = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); - } - $obj = null; - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $obj = new TaxRuleDesc(); - $obj->hydrate($row); - TaxRuleDescPeer::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return TaxRuleDesc|TaxRuleDesc[]|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|TaxRuleDesc[]|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if ($con === null) { - $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($stmt); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(TaxRuleDescPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(TaxRuleDescPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - - return $this->addUsingAlias(TaxRuleDescPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the tax_rule_id column - * - * Example usage: - * - * $query->filterByTaxRuleId(1234); // WHERE tax_rule_id = 1234 - * $query->filterByTaxRuleId(array(12, 34)); // WHERE tax_rule_id IN (12, 34) - * $query->filterByTaxRuleId(array('min' => 12)); // WHERE tax_rule_id > 12 - * - * - * @see filterByTaxRule() - * - * @param mixed $taxRuleId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function filterByTaxRuleId($taxRuleId = null, $comparison = null) - { - if (is_array($taxRuleId)) { - $useMinMax = false; - if (isset($taxRuleId['min'])) { - $this->addUsingAlias(TaxRuleDescPeer::TAX_RULE_ID, $taxRuleId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($taxRuleId['max'])) { - $this->addUsingAlias(TaxRuleDescPeer::TAX_RULE_ID, $taxRuleId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(TaxRuleDescPeer::TAX_RULE_ID, $taxRuleId, $comparison); - } - - /** - * Filter the query on the lang column - * - * Example usage: - * - * $query->filterByLang('fooValue'); // WHERE lang = 'fooValue' - * $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%' - * - * - * @param string $lang The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function filterByLang($lang = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lang)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lang)) { - $lang = str_replace('*', '%', $lang); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(TaxRuleDescPeer::LANG, $lang, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(TaxRuleDescPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(TaxRuleDescPeer::DESCRIPTION, $description, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(TaxRuleDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(TaxRuleDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(TaxRuleDescPeer::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(TaxRuleDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(TaxRuleDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(TaxRuleDescPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related TaxRule object - * - * @param TaxRule|PropelObjectCollection $taxRule The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return TaxRuleDescQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByTaxRule($taxRule, $comparison = null) - { - if ($taxRule instanceof TaxRule) { - return $this - ->addUsingAlias(TaxRuleDescPeer::TAX_RULE_ID, $taxRule->getId(), $comparison); - } elseif ($taxRule instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(TaxRuleDescPeer::TAX_RULE_ID, $taxRule->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByTaxRule() only accepts arguments of type TaxRule or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the TaxRule relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function joinTaxRule($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('TaxRule'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'TaxRule'); - } - - return $this; - } - - /** - * Use the TaxRule relation TaxRule object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\TaxRuleQuery A secondary query class using the current class as primary query - */ - public function useTaxRuleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinTaxRule($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'TaxRule', '\Thelia\Model\TaxRuleQuery'); - } - - /** - * Exclude object from result - * - * @param TaxRuleDesc $taxRuleDesc Object to remove from the list of results - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function prune($taxRuleDesc = null) - { - if ($taxRuleDesc) { - $this->addUsingAlias(TaxRuleDescPeer::ID, $taxRuleDesc->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(TaxRuleDescPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(TaxRuleDescPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(TaxRuleDescPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(TaxRuleDescPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(TaxRuleDescPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return TaxRuleDescQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(TaxRuleDescPeer::CREATED_AT); - } -} diff --git a/local/config/schema.xml b/local/config/schema.xml index c7759fb20..1ad231287 100644 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -673,7 +673,7 @@ - +