diff --git a/src/Deblan/Bundle/BlogBundle/Resources/public/js/main.js b/src/Deblan/Bundle/BlogBundle/Resources/public/js/main.js index 7cca30e..7a4ae32 100644 --- a/src/Deblan/Bundle/BlogBundle/Resources/public/js/main.js +++ b/src/Deblan/Bundle/BlogBundle/Resources/public/js/main.js @@ -143,7 +143,7 @@ if (!readCookie('private_life')) { createCookie('private_life', '1', 365); $('#cookie').removeClass('hide').css({ - top: 57, + bottom: 0, position: 'absolute', width: '100%' }); diff --git a/vendor/trinity/src/Trinity/.svn/wc.db b/vendor/trinity/src/Trinity/.svn/wc.db index 6cd32bb..1aaf292 100644 Binary files a/vendor/trinity/src/Trinity/.svn/wc.db and b/vendor/trinity/src/Trinity/.svn/wc.db differ diff --git a/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/Controller/DefaultController.php b/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/Controller/DefaultController.php index d93f20b..22a96a1 100644 --- a/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/Controller/DefaultController.php +++ b/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/Controller/DefaultController.php @@ -72,6 +72,7 @@ class DefaultController extends Controller 'menu_render' => $renderer->render($menu), 'menu' => $menu, 'logo' => $this->config['logo'], + 'route_name' => $this->config['route_name'], ) ); } diff --git a/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/DependencyInjection/Configuration.php b/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/DependencyInjection/Configuration.php index e11e074..e665717 100644 --- a/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/DependencyInjection/Configuration.php +++ b/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/DependencyInjection/Configuration.php @@ -27,6 +27,7 @@ class Configuration implements ConfigurationInterface ->scalarNode('template')->defaultValue('TrinityAdminMenuBundle:Default:mainMenu.html.twig')->end() ->scalarNode('title')->defaultValue('Admin menu')->end() ->scalarNode('logo')->defaultValue('/bundles/trinityadminmenu/img/logo.png')->end() + ->scalarNode('route_name')->defaultValue('TrinityDashBoardBundle_index')->end() ->arrayNode('items') ->prototype('array') diff --git a/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/Resources/views/Default/mainMenu.html.twig b/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/Resources/views/Default/mainMenu.html.twig index a77afbe..8781f8d 100644 --- a/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/Resources/views/Default/mainMenu.html.twig +++ b/vendor/trinity/src/Trinity/Bundle/AdminMenuBundle/Resources/views/Default/mainMenu.html.twig @@ -3,7 +3,7 @@
{% if logo %} - + {% if logo|slice(0, 4) == 'Trinity\Bundle\ContentManagerBundle\Routing\NodeLoader Trinity\Bundle\ContentManagerBundle\Routing\Cache Trinity\Bundle\ContentManagerBundle\Twig\Extension\ObjectExtension + Trinity\Bundle\ContentManagerBundle\Twig\Extension\SeasonsExtension Trinity\Bundle\ContentManagerBundle\Twig\Extension\PageExtension Trinity\Bundle\ContentManagerBundle\Twig\Extension\UrlExtension Trinity\Bundle\ContentManagerBundle\Twig\Extension\BlockExtension diff --git a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/Media.php b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/Media.php index 11ce462..9b736d5 100644 --- a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/Media.php +++ b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/Media.php @@ -57,17 +57,21 @@ class Media extends BaseMedia return basename($this->getFile()); } - public function save(\PropelPDO $con = null) + public function setTypeId($id) { - if (!$this->getTypeId() && $this->getFileAsFile()) { - $this->setTypeId(TypePeer::getTypeFor($this->getFileAsFile())); + if ($id === '') { + $id = null; } - return parent::save($con); + parent::setTypeId($id); } public function postSave(\PropelPDO $con = null) { + // if (!$this->getTypeId() && $this->getFileAsFile()) { + // $this->setTypeId(TypePeer::getTypeFor($this->getFileAsFile())); + // } + if ($this->hasUploadedFile()) { if (@getimagesize($this->getWebPathForFile())) { Image::create($this->getWebPathForFile()) diff --git a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/TypePeer.php b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/TypePeer.php index d4d3ab7..e99c9fe 100644 --- a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/TypePeer.php +++ b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/TypePeer.php @@ -9,7 +9,10 @@ class TypePeer extends BaseTypePeer { public static function getTypeFor(File $file) { + var_dump($file->getMimeType()); $type = TypeQuery::create()->findOneByMimes('%'.$file->getMimeType().'%'); + var_dump($type); + die; return count($type) ? $type->getId() : null; } diff --git a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/CategoryTableMap.php b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/CategoryTableMap.php index 694482f..7f6e078 100644 --- a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/CategoryTableMap.php +++ b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/CategoryTableMap.php @@ -60,7 +60,7 @@ class CategoryTableMap extends TableMap public function buildRelations() { $this->addRelation('CategoryRelatedByCategoryId', 'Trinity\\Bundle\\MediaBundle\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), null, 'CASCADE'); - $this->addRelation('Media', 'Trinity\\Bundle\\MediaBundle\\Model\\Media', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), null, 'CASCADE', 'Medias'); + $this->addRelation('Media', 'Trinity\\Bundle\\MediaBundle\\Model\\Media', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), null, null, 'Medias'); $this->addRelation('CategoryRelatedById', 'Trinity\\Bundle\\MediaBundle\\Model\\Category', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), null, 'CASCADE', 'CategoriesRelatedById'); } // buildRelations() diff --git a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/MediaTableMap.php b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/MediaTableMap.php index 9c1759f..c16d730 100644 --- a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/MediaTableMap.php +++ b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/MediaTableMap.php @@ -56,8 +56,8 @@ class MediaTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('Type', 'Trinity\\Bundle\\MediaBundle\\Model\\Type', RelationMap::MANY_TO_ONE, array('type_id' => 'id', ), null, 'CASCADE'); - $this->addRelation('Category', 'Trinity\\Bundle\\MediaBundle\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), null, 'CASCADE'); + $this->addRelation('Type', 'Trinity\\Bundle\\MediaBundle\\Model\\Type', RelationMap::MANY_TO_ONE, array('type_id' => 'id', ), 'SET NULL', 'SET NULL'); + $this->addRelation('Category', 'Trinity\\Bundle\\MediaBundle\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), null, null); } // buildRelations() /** diff --git a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/TypeTableMap.php b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/TypeTableMap.php index 0e91ed9..dd2295a 100644 --- a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/TypeTableMap.php +++ b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/map/TypeTableMap.php @@ -59,7 +59,7 @@ class TypeTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('Media', 'Trinity\\Bundle\\MediaBundle\\Model\\Media', RelationMap::ONE_TO_MANY, array('id' => 'type_id', ), null, 'CASCADE', 'Medias'); + $this->addRelation('Media', 'Trinity\\Bundle\\MediaBundle\\Model\\Media', RelationMap::ONE_TO_MANY, array('id' => 'type_id', ), 'SET NULL', 'SET NULL', 'Medias'); } // buildRelations() /** diff --git a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/om/BaseTypePeer.php b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/om/BaseTypePeer.php index 5fa15dc..0165a59 100644 --- a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/om/BaseTypePeer.php +++ b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Model/om/BaseTypePeer.php @@ -9,6 +9,7 @@ use \PDOStatement; use \Propel; use \PropelException; use \PropelPDO; +use Trinity\Bundle\MediaBundle\Model\MediaPeer; use Trinity\Bundle\MediaBundle\Model\Type; use Trinity\Bundle\MediaBundle\Model\TypePeer; use Trinity\Bundle\MediaBundle\Model\TypeQuery; @@ -417,6 +418,9 @@ abstract class BaseTypePeer */ public static function clearRelatedInstancePool() { + // Invalidate objects in MediaPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + MediaPeer::clearInstancePool(); } /** @@ -646,6 +650,7 @@ abstract class BaseTypePeer // use transaction because $criteria could contain info // for more than one table or we could emulating ON DELETE CASCADE, etc. $con->beginTransaction(); + TypePeer::doOnDeleteSetNull(new Criteria(TypePeer::DATABASE_NAME), $con); $affectedRows += BasePeer::doDeleteAll(TypePeer::TABLE_NAME, $con, TypePeer::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 @@ -679,24 +684,14 @@ abstract class BaseTypePeer } 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. - TypePeer::clearInstancePool(); // rename for clarity $criteria = clone $values; } elseif ($values instanceof Type) { // it's a model object - // invalidate the cache for this single object - TypePeer::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(TypePeer::DATABASE_NAME); $criteria->add(TypePeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - TypePeer::removeInstanceFromPool($singleval); - } } // Set the correct dbName @@ -709,6 +704,23 @@ abstract class BaseTypePeer // for more than one table or we could emulating ON DELETE CASCADE, etc. $con->beginTransaction(); + // cloning the Criteria in case it's modified by doSelect() or doSelectStmt() + $c = clone $criteria; + TypePeer::doOnDeleteSetNull($c, $con); + + // 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). + if ($values instanceof Criteria) { + TypePeer::clearInstancePool(); + } elseif ($values instanceof Type) { // it's a model object + TypePeer::removeInstanceFromPool($values); + } else { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { + TypePeer::removeInstanceFromPool($singleval); + } + } + $affectedRows += BasePeer::doDelete($criteria, $con); TypePeer::clearRelatedInstancePool(); $con->commit(); @@ -720,6 +732,37 @@ abstract class BaseTypePeer } } + /** + * This is a method for emulating ON DELETE SET NULL DBs that don't support this + * feature (like MySQL or SQLite). + * + * This method is not very speedy because it must perform a query first to get + * the implicated records and then perform the deletes by calling those Peer classes. + * + * This method should be used within a transaction if possible. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @return void + */ + protected static function doOnDeleteSetNull(Criteria $criteria, PropelPDO $con) + { + + // first find the objects that are implicated by the $criteria + $objects = TypePeer::doSelect($criteria, $con); + foreach ($objects as $obj) { + + // set fkey col in related Media rows to null + $selectCriteria = new Criteria(TypePeer::DATABASE_NAME); + $updateValues = new Criteria(TypePeer::DATABASE_NAME); + $selectCriteria->add(MediaPeer::TYPE_ID, $obj->getId()); + $updateValues->add(MediaPeer::TYPE_ID, null); + + BasePeer::doUpdate($selectCriteria, $updateValues, $con); // use BasePeer because generated Peer doUpdate() methods only update using pkey + + } + } + /** * Validates all modified columns of given Type object. * If parameter $columns is either a single column name or an array of column names diff --git a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Resources/config/schema.xml b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Resources/config/schema.xml index 8b92397..e71b1c4 100644 --- a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Resources/config/schema.xml +++ b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Resources/config/schema.xml @@ -2,13 +2,13 @@ - - + + - + - + diff --git a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Resources/views/MediaTinyMCEAdmin/index.html.twig b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Resources/views/MediaTinyMCEAdmin/index.html.twig index 9bbcd84..0c48d32 100644 --- a/vendor/trinity/src/Trinity/Bundle/MediaBundle/Resources/views/MediaTinyMCEAdmin/index.html.twig +++ b/vendor/trinity/src/Trinity/Bundle/MediaBundle/Resources/views/MediaTinyMCEAdmin/index.html.twig @@ -145,13 +145,12 @@ var mimes = $(this).data('mime'); var iconType = $(this).data('icon'); - if(mimes) { + if (mimes) { tinymce.EditorManager.activeEditor.insertContent(''); - }else{ + } else{ tinymce.EditorManager.activeEditor.insertContent(''); } - close(); }); diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/BlockTableMap.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/BlockTableMap.php deleted file mode 100644 index 8729ab9..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/BlockTableMap.php +++ /dev/null @@ -1,100 +0,0 @@ -setName('nws_block'); - $this->setPhpName('Block'); - $this->setClassname('Trinity\\Bundle\\NewsletterBundle\\Model\\Block'); - $this->setPackage('vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model'); - $this->setUseIdGenerator(true); - $this->setSingleTableInheritance(true); - // columns - $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); - $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null); - $this->addColumn('value', 'Value', 'LONGVARCHAR', false, null, null); - $this->addColumn('class_key', 'ClassKey', 'VARCHAR', false, 255, null); - $this->addColumn('template', 'Template', 'VARCHAR', false, 255, null); - $this->addForeignKey('model_id', 'ModelId', 'INTEGER', 'nws_model', 'id', false, null, null); - $this->addColumn('created_at', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('updated_at', 'UpdatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('version', 'Version', 'INTEGER', false, null, 0); - $this->addColumn('version_created_at', 'VersionCreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('version_created_by', 'VersionCreatedBy', 'VARCHAR', false, 100, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Model', 'Trinity\\Bundle\\NewsletterBundle\\Model\\Model', RelationMap::MANY_TO_ONE, array('model_id' => 'id', ), 'CASCADE', null); - $this->addRelation('BlockVersion', 'Trinity\\Bundle\\NewsletterBundle\\Model\\BlockVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'BlockVersions'); - } // 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', -), - 'versionable' => array ( - 'version_column' => 'version', - 'version_table' => '', - 'log_created_at' => 'true', - 'log_created_by' => 'true', - 'log_comment' => 'false', - 'version_created_at_column' => 'version_created_at', - 'version_created_by_column' => 'version_created_by', - 'version_comment_column' => 'version_comment', -), - 'event' => array ( -), - 'extend' => array ( -), - ); - } // getBehaviors() - -} // BlockTableMap diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/BlockVersionTableMap.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/BlockVersionTableMap.php deleted file mode 100644 index a7ea326..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/BlockVersionTableMap.php +++ /dev/null @@ -1,85 +0,0 @@ -setName('nws_block_version'); - $this->setPhpName('BlockVersion'); - $this->setClassname('Trinity\\Bundle\\NewsletterBundle\\Model\\BlockVersion'); - $this->setPackage('vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model'); - $this->setUseIdGenerator(false); - $this->setSingleTableInheritance(true); - // columns - $this->addForeignPrimaryKey('id', 'Id', 'INTEGER' , 'nws_block', 'id', true, null, null); - $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null); - $this->addColumn('value', 'Value', 'LONGVARCHAR', false, null, null); - $this->addColumn('class_key', 'ClassKey', 'VARCHAR', false, 255, null); - $this->addColumn('template', 'Template', 'VARCHAR', false, 255, null); - $this->addColumn('model_id', 'ModelId', 'INTEGER', false, null, null); - $this->addColumn('created_at', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('updated_at', 'UpdatedAt', 'TIMESTAMP', false, null, null); - $this->addPrimaryKey('version', 'Version', 'INTEGER', true, null, 0); - $this->addColumn('version_created_at', 'VersionCreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('version_created_by', 'VersionCreatedBy', 'VARCHAR', false, 100, null); - $this->addColumn('model_id_version', 'ModelIdVersion', 'INTEGER', false, null, 0); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Block', 'Trinity\\Bundle\\NewsletterBundle\\Model\\Block', RelationMap::MANY_TO_ONE, array('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( - 'event' => array ( -), - 'extend' => array ( -), - ); - } // getBehaviors() - -} // BlockVersionTableMap diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/ModelTableMap.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/ModelTableMap.php deleted file mode 100644 index 6f98869..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/ModelTableMap.php +++ /dev/null @@ -1,99 +0,0 @@ -setName('nws_model'); - $this->setPhpName('Model'); - $this->setClassname('Trinity\\Bundle\\NewsletterBundle\\Model\\Model'); - $this->setPackage('vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model'); - $this->setUseIdGenerator(true); - $this->setSingleTableInheritance(true); - // columns - $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); - $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null); - $this->addColumn('template', 'Template', 'VARCHAR', true, 255, null); - $this->addColumn('class_key', 'ClassKey', 'VARCHAR', false, 255, null); - $this->addColumn('created_at', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('updated_at', 'UpdatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('version', 'Version', 'INTEGER', false, null, 0); - $this->addColumn('version_created_at', 'VersionCreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('version_created_by', 'VersionCreatedBy', 'VARCHAR', false, 100, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Newsletter', 'Trinity\\Bundle\\NewsletterBundle\\Model\\Newsletter', RelationMap::ONE_TO_MANY, array('id' => 'model_id', ), null, null, 'Newsletters'); - $this->addRelation('Block', 'Trinity\\Bundle\\NewsletterBundle\\Model\\Block', RelationMap::ONE_TO_MANY, array('id' => 'model_id', ), 'CASCADE', null, 'Blocks'); - $this->addRelation('ModelVersion', 'Trinity\\Bundle\\NewsletterBundle\\Model\\ModelVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ModelVersions'); - } // 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', -), - 'versionable' => array ( - 'version_column' => 'version', - 'version_table' => '', - 'log_created_at' => 'true', - 'log_created_by' => 'true', - 'log_comment' => 'false', - 'version_created_at_column' => 'version_created_at', - 'version_created_by_column' => 'version_created_by', - 'version_comment_column' => 'version_comment', -), - 'event' => array ( -), - 'extend' => array ( -), - ); - } // getBehaviors() - -} // ModelTableMap diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/ModelVersionTableMap.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/ModelVersionTableMap.php deleted file mode 100644 index 7a4d5db..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/ModelVersionTableMap.php +++ /dev/null @@ -1,84 +0,0 @@ -setName('nws_model_version'); - $this->setPhpName('ModelVersion'); - $this->setClassname('Trinity\\Bundle\\NewsletterBundle\\Model\\ModelVersion'); - $this->setPackage('vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model'); - $this->setUseIdGenerator(false); - $this->setSingleTableInheritance(true); - // columns - $this->addForeignPrimaryKey('id', 'Id', 'INTEGER' , 'nws_model', 'id', true, null, null); - $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null); - $this->addColumn('template', 'Template', 'VARCHAR', true, 255, null); - $this->addColumn('class_key', 'ClassKey', 'VARCHAR', false, 255, null); - $this->addColumn('created_at', 'CreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('updated_at', 'UpdatedAt', 'TIMESTAMP', false, null, null); - $this->addPrimaryKey('version', 'Version', 'INTEGER', true, null, 0); - $this->addColumn('version_created_at', 'VersionCreatedAt', 'TIMESTAMP', false, null, null); - $this->addColumn('version_created_by', 'VersionCreatedBy', 'VARCHAR', false, 100, null); - $this->addColumn('nws_block_ids', 'NwsBlockIds', 'ARRAY', false, null, null); - $this->addColumn('nws_block_versions', 'NwsBlockVersions', 'ARRAY', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Model', 'Trinity\\Bundle\\NewsletterBundle\\Model\\Model', RelationMap::MANY_TO_ONE, array('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( - 'event' => array ( -), - 'extend' => array ( -), - ); - } // getBehaviors() - -} // ModelVersionTableMap diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/NewsletterRecipientsTableMap.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/NewsletterRecipientsTableMap.php deleted file mode 100644 index b2a966b..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/NewsletterRecipientsTableMap.php +++ /dev/null @@ -1,76 +0,0 @@ -setName('nws_newsletter_recipients'); - $this->setPhpName('NewsletterRecipients'); - $this->setClassname('Trinity\\Bundle\\NewsletterBundle\\Model\\NewsletterRecipients'); - $this->setPackage('vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model'); - $this->setUseIdGenerator(false); - $this->setIsCrossRef(true); - // columns - $this->addForeignPrimaryKey('nws_newsletter_id', 'NwsNewsletterId', 'INTEGER' , 'nws_newsletter', 'id', true, null, null); - $this->addForeignPrimaryKey('fos_group_id', 'FosGroupId', 'INTEGER' , 'fos_group', 'id', true, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Newsletter', 'Trinity\\Bundle\\NewsletterBundle\\Model\\Newsletter', RelationMap::MANY_TO_ONE, array('nws_newsletter_id' => 'id', ), null, null); - $this->addRelation('Group', 'FOS\\UserBundle\\Propel\\Group', RelationMap::MANY_TO_ONE, array('fos_group_id' => 'id', ), null, null); - } // buildRelations() - - /** - * - * Gets the list of behaviors registered for this table - * - * @return array Associative array (name => parameters) of behaviors - */ - public function getBehaviors() - { - return array( - 'event' => array ( -), - 'extend' => array ( -), - ); - } // getBehaviors() - -} // NewsletterRecipientsTableMap diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/NewsletterTableMap.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/NewsletterTableMap.php deleted file mode 100644 index 5208738..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/map/NewsletterTableMap.php +++ /dev/null @@ -1,88 +0,0 @@ -setName('nws_newsletter'); - $this->setPhpName('Newsletter'); - $this->setClassname('Trinity\\Bundle\\NewsletterBundle\\Model\\Newsletter'); - $this->setPackage('vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); - $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null); - $this->addColumn('sender_name', 'SenderName', 'VARCHAR', false, 255, null); - $this->addColumn('sender_email', 'SenderEmail', 'VARCHAR', false, 255, null); - $this->addForeignKey('model_id', 'ModelId', 'INTEGER', 'nws_model', 'id', false, null, null); - $this->addColumn('email_listing', 'EmailListing', 'LONGVARCHAR', false, null, null); - $this->addColumn('sent_at', 'SentAt', 'TIMESTAMP', 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('Model', 'Trinity\\Bundle\\NewsletterBundle\\Model\\Model', RelationMap::MANY_TO_ONE, array('model_id' => 'id', ), null, null); - $this->addRelation('NewsletterRecipients', 'Trinity\\Bundle\\NewsletterBundle\\Model\\NewsletterRecipients', RelationMap::ONE_TO_MANY, array('id' => 'nws_newsletter_id', ), null, null, 'NewsletterRecipientss'); - $this->addRelation('Group', 'FOS\\UserBundle\\Propel\\Group', RelationMap::MANY_TO_MANY, array(), null, null, 'Groups'); - } // 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', -), - 'event' => array ( -), - 'extend' => array ( -), - ); - } // getBehaviors() - -} // NewsletterTableMap diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlock.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlock.php deleted file mode 100644 index c53aa78..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlock.php +++ /dev/null @@ -1,2275 +0,0 @@ -version = 0; - } - - /** - * Initializes internal state of BaseBlock object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - EventDispatcherProxy::trigger(array('construct','model.construct'), new ModelEvent($this)); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getId() - { - - return $this->id; - } - - /** - * Get the [name] column value. - * - * @return string - */ - public function getName() - { - - return $this->name; - } - - /** - * Get the [value] column value. - * - * @return string - */ - public function getValue() - { - - return $this->value; - } - - /** - * Get the [class_key] column value. - * - * @return string - */ - public function getClassKey() - { - - return $this->class_key; - } - - /** - * Get the [template] column value. - * - * @return string - */ - public function getTemplate() - { - - return $this->template; - } - - /** - * Get the [model_id] column value. - * - * @return int - */ - public function getModelId() - { - - return $this->model_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 = null) - { - 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; - } - - 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; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - 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 = null) - { - 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; - } - - 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; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * Get the [version] column value. - * - * @return int - */ - public function getVersion() - { - - return $this->version; - } - - /** - * Get the [optionally formatted] temporal [version_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 getVersionCreatedAt($format = null) - { - if ($this->version_created_at === null) { - return null; - } - - if ($this->version_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; - } - - try { - $dt = new DateTime($this->version_created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * Get the [version_created_by] column value. - * - * @return string - */ - public function getVersionCreatedBy() - { - - return $this->version_created_by; - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return Block The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = BlockPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [name] column. - * - * @param string $v new value - * @return Block The current object (for fluent API support) - */ - public function setName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->name !== $v) { - $this->name = $v; - $this->modifiedColumns[] = BlockPeer::NAME; - } - - - return $this; - } // setName() - - /** - * Set the value of [value] column. - * - * @param string $v new value - * @return Block The current object (for fluent API support) - */ - public function setValue($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->value !== $v) { - $this->value = $v; - $this->modifiedColumns[] = BlockPeer::VALUE; - } - - - return $this; - } // setValue() - - /** - * Set the value of [class_key] column. - * - * @param string $v new value - * @return Block The current object (for fluent API support) - */ - public function setClassKey($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->class_key !== $v) { - $this->class_key = $v; - $this->modifiedColumns[] = BlockPeer::CLASS_KEY; - } - - - return $this; - } // setClassKey() - - /** - * Set the value of [template] column. - * - * @param string $v new value - * @return Block The current object (for fluent API support) - */ - public function setTemplate($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->template !== $v) { - $this->template = $v; - $this->modifiedColumns[] = BlockPeer::TEMPLATE; - } - - - return $this; - } // setTemplate() - - /** - * Set the value of [model_id] column. - * - * @param int $v new value - * @return Block The current object (for fluent API support) - */ - public function setModelId($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->model_id !== $v) { - $this->model_id = $v; - $this->modifiedColumns[] = BlockPeer::MODEL_ID; - } - - if ($this->aModel !== null && $this->aModel->getId() !== $v) { - $this->aModel = null; - } - - - return $this; - } // setModelId() - - /** - * 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 Block 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[] = BlockPeer::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 Block 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[] = BlockPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Set the value of [version] column. - * - * @param int $v new value - * @return Block The current object (for fluent API support) - */ - public function setVersion($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->version !== $v) { - $this->version = $v; - $this->modifiedColumns[] = BlockPeer::VERSION; - } - - - return $this; - } // setVersion() - - /** - * Sets the value of [version_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 Block The current object (for fluent API support) - */ - public function setVersionCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->version_created_at !== null || $dt !== null) { - $currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_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->version_created_at = $newDateAsString; - $this->modifiedColumns[] = BlockPeer::VERSION_CREATED_AT; - } - } // if either are not null - - - return $this; - } // setVersionCreatedAt() - - /** - * Set the value of [version_created_by] column. - * - * @param string $v new value - * @return Block The current object (for fluent API support) - */ - public function setVersionCreatedBy($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->version_created_by !== $v) { - $this->version_created_by = $v; - $this->modifiedColumns[] = BlockPeer::VERSION_CREATED_BY; - } - - - return $this; - } // setVersionCreatedBy() - - /** - * 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() - { - if ($this->version !== 0) { - return false; - } - - // 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 resultset 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->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->value = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->class_key = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->template = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->model_id = ($row[$startcol + 5] !== null) ? (int) $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->version = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; - $this->version_created_at = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; - $this->version_created_by = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - $this->postHydrate($row, $startcol, $rehydrate); - - return $startcol + 11; // 11 = BlockPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating Block 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->aModel !== null && $this->model_id !== $this->aModel->getId()) { - $this->aModel = 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(BlockPeer::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 = BlockPeer::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->aModel = null; - $this->collBlockVersions = 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(BlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = BlockQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','model.delete.pre'), new ModelEvent($this)); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - // versionable behavior - // emulate delete cascade - BlockVersionQuery::create() - ->filterByBlock($this) - ->delete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.post', 'model.delete.post'), new ModelEvent($this)); - $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(BlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - // versionable behavior - if ($this->isVersioningNecessary()) { - $this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1); - if (!$this->isColumnModified(BlockPeer::VERSION_CREATED_AT)) { - $this->setVersionCreatedAt(time()); - } - $createVersion = true; // for postSave hook - } - // event behavior - EventDispatcherProxy::trigger('model.save.pre', new ModelEvent($this)); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(BlockPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(BlockPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - // event behavior - EventDispatcherProxy::trigger('model.insert.pre', new ModelEvent($this)); - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(BlockPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'model.update.pre'), new ModelEvent($this)); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - // event behavior - EventDispatcherProxy::trigger('model.insert.post', new ModelEvent($this)); - } else { - $this->postUpdate($con); - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'model.update.post'), new ModelEvent($this)); - } - $this->postSave($con); - // versionable behavior - if (isset($createVersion)) { - $this->addVersion($con); - } - // event behavior - EventDispatcherProxy::trigger('model.save.post', new ModelEvent($this)); - BlockPeer::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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aModel !== null) { - if ($this->aModel->isModified() || $this->aModel->isNew()) { - $affectedRows += $this->aModel->save($con); - } - $this->setModel($this->aModel); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - if ($this->blockVersionsScheduledForDeletion !== null) { - if (!$this->blockVersionsScheduledForDeletion->isEmpty()) { - BlockVersionQuery::create() - ->filterByPrimaryKeys($this->blockVersionsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->blockVersionsScheduledForDeletion = null; - } - } - - if ($this->collBlockVersions !== null) { - foreach ($this->collBlockVersions as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - - $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[] = BlockPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . BlockPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(BlockPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`id`'; - } - if ($this->isColumnModified(BlockPeer::NAME)) { - $modifiedColumns[':p' . $index++] = '`name`'; - } - if ($this->isColumnModified(BlockPeer::VALUE)) { - $modifiedColumns[':p' . $index++] = '`value`'; - } - if ($this->isColumnModified(BlockPeer::CLASS_KEY)) { - $modifiedColumns[':p' . $index++] = '`class_key`'; - } - if ($this->isColumnModified(BlockPeer::TEMPLATE)) { - $modifiedColumns[':p' . $index++] = '`template`'; - } - if ($this->isColumnModified(BlockPeer::MODEL_ID)) { - $modifiedColumns[':p' . $index++] = '`model_id`'; - } - if ($this->isColumnModified(BlockPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`created_at`'; - } - if ($this->isColumnModified(BlockPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`updated_at`'; - } - if ($this->isColumnModified(BlockPeer::VERSION)) { - $modifiedColumns[':p' . $index++] = '`version`'; - } - if ($this->isColumnModified(BlockPeer::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`version_created_at`'; - } - if ($this->isColumnModified(BlockPeer::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = '`version_created_by`'; - } - - $sql = sprintf( - 'INSERT INTO `nws_block` (%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 '`name`': - $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); - break; - case '`value`': - $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR); - break; - case '`class_key`': - $stmt->bindValue($identifier, $this->class_key, PDO::PARAM_STR); - break; - case '`template`': - $stmt->bindValue($identifier, $this->template, PDO::PARAM_STR); - break; - case '`model_id`': - $stmt->bindValue($identifier, $this->model_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; - case '`version`': - $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); - break; - case '`version_created_at`': - $stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR); - break; - case '`version_created_by`': - $stmt->bindValue($identifier, $this->version_created_by, 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; - } - - $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 aggregated 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 objects 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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aModel !== null) { - if (!$this->aModel->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aModel->getValidationFailures()); - } - } - - - if (($retval = BlockPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - if ($this->collBlockVersions !== null) { - foreach ($this->collBlockVersions as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - - $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 = BlockPeer::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->getName(); - break; - case 2: - return $this->getValue(); - break; - case 3: - return $this->getClassKey(); - break; - case 4: - return $this->getTemplate(); - break; - case 5: - return $this->getModelId(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - case 8: - return $this->getVersion(); - break; - case 9: - return $this->getVersionCreatedAt(); - break; - case 10: - return $this->getVersionCreatedBy(); - 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['Block'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['Block'][$this->getPrimaryKey()] = true; - $keys = BlockPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getName(), - $keys[2] => $this->getValue(), - $keys[3] => $this->getClassKey(), - $keys[4] => $this->getTemplate(), - $keys[5] => $this->getModelId(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - $keys[8] => $this->getVersion(), - $keys[9] => $this->getVersionCreatedAt(), - $keys[10] => $this->getVersionCreatedBy(), - ); - $virtualColumns = $this->virtualColumns; - foreach ($virtualColumns as $key => $virtualColumn) { - $result[$key] = $virtualColumn; - } - - if ($includeForeignObjects) { - if (null !== $this->aModel) { - $result['Model'] = $this->aModel->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - if (null !== $this->collBlockVersions) { - $result['BlockVersions'] = $this->collBlockVersions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } - } - - 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 = BlockPeer::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->setName($value); - break; - case 2: - $this->setValue($value); - break; - case 3: - $this->setClassKey($value); - break; - case 4: - $this->setTemplate($value); - break; - case 5: - $this->setModelId($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - case 8: - $this->setVersion($value); - break; - case 9: - $this->setVersionCreatedAt($value); - break; - case 10: - $this->setVersionCreatedBy($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 = BlockPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setValue($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setClassKey($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setTemplate($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setModelId($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]]); - if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]); - } - - /** - * 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(BlockPeer::DATABASE_NAME); - - if ($this->isColumnModified(BlockPeer::ID)) $criteria->add(BlockPeer::ID, $this->id); - if ($this->isColumnModified(BlockPeer::NAME)) $criteria->add(BlockPeer::NAME, $this->name); - if ($this->isColumnModified(BlockPeer::VALUE)) $criteria->add(BlockPeer::VALUE, $this->value); - if ($this->isColumnModified(BlockPeer::CLASS_KEY)) $criteria->add(BlockPeer::CLASS_KEY, $this->class_key); - if ($this->isColumnModified(BlockPeer::TEMPLATE)) $criteria->add(BlockPeer::TEMPLATE, $this->template); - if ($this->isColumnModified(BlockPeer::MODEL_ID)) $criteria->add(BlockPeer::MODEL_ID, $this->model_id); - if ($this->isColumnModified(BlockPeer::CREATED_AT)) $criteria->add(BlockPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(BlockPeer::UPDATED_AT)) $criteria->add(BlockPeer::UPDATED_AT, $this->updated_at); - if ($this->isColumnModified(BlockPeer::VERSION)) $criteria->add(BlockPeer::VERSION, $this->version); - if ($this->isColumnModified(BlockPeer::VERSION_CREATED_AT)) $criteria->add(BlockPeer::VERSION_CREATED_AT, $this->version_created_at); - if ($this->isColumnModified(BlockPeer::VERSION_CREATED_BY)) $criteria->add(BlockPeer::VERSION_CREATED_BY, $this->version_created_by); - - 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(BlockPeer::DATABASE_NAME); - $criteria->add(BlockPeer::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 Block (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->setName($this->getName()); - $copyObj->setValue($this->getValue()); - $copyObj->setClassKey($this->getClassKey()); - $copyObj->setTemplate($this->getTemplate()); - $copyObj->setModelId($this->getModelId()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - $copyObj->setVersion($this->getVersion()); - $copyObj->setVersionCreatedAt($this->getVersionCreatedAt()); - $copyObj->setVersionCreatedBy($this->getVersionCreatedBy()); - - 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; - - foreach ($this->getBlockVersions() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addBlockVersion($relObj->copy($deepCopy)); - } - } - - //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 Block 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 BlockPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new BlockPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Model object. - * - * @param Model $v - * @return Block The current object (for fluent API support) - * @throws PropelException - */ - public function setModel(Model $v = null) - { - if ($v === null) { - $this->setModelId(NULL); - } else { - $this->setModelId($v->getId()); - } - - $this->aModel = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Model object, it will not be re-added. - if ($v !== null) { - $v->addBlock($this); - } - - - return $this; - } - - - /** - * Get the associated Model object - * - * @param PropelPDO $con Optional Connection object. - * @param $doQuery Executes a query to get the object if required - * @return Model The associated Model object. - * @throws PropelException - */ - public function getModel(PropelPDO $con = null, $doQuery = true) - { - if ($this->aModel === null && ($this->model_id !== null) && $doQuery) { - $this->aModel = ModelQuery::create()->findPk($this->model_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->aModel->addBlocks($this); - */ - } - - return $this->aModel; - } - - - /** - * Initializes a collection based on the name of a relation. - * Avoids crafting an 'init[$relationName]s' method name - * that wouldn't work when StandardEnglishPluralizer is used. - * - * @param string $relationName The name of the relation to initialize - * @return void - */ - public function initRelation($relationName) - { - if ('BlockVersion' == $relationName) { - $this->initBlockVersions(); - } - } - - /** - * Clears out the collBlockVersions collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return Block The current object (for fluent API support) - * @see addBlockVersions() - */ - public function clearBlockVersions() - { - $this->collBlockVersions = null; // important to set this to null since that means it is uninitialized - $this->collBlockVersionsPartial = null; - - return $this; - } - - /** - * reset is the collBlockVersions collection loaded partially - * - * @return void - */ - public function resetPartialBlockVersions($v = true) - { - $this->collBlockVersionsPartial = $v; - } - - /** - * Initializes the collBlockVersions collection. - * - * By default this just sets the collBlockVersions collection to an empty array (like clearcollBlockVersions()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initBlockVersions($overrideExisting = true) - { - if (null !== $this->collBlockVersions && !$overrideExisting) { - return; - } - $this->collBlockVersions = new PropelObjectCollection(); - $this->collBlockVersions->setModel('BlockVersion'); - } - - /** - * Gets an array of BlockVersion objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this Block is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelObjectCollection|BlockVersion[] List of BlockVersion objects - * @throws PropelException - */ - public function getBlockVersions($criteria = null, PropelPDO $con = null) - { - $partial = $this->collBlockVersionsPartial && !$this->isNew(); - if (null === $this->collBlockVersions || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collBlockVersions) { - // return empty collection - $this->initBlockVersions(); - } else { - $collBlockVersions = BlockVersionQuery::create(null, $criteria) - ->filterByBlock($this) - ->find($con); - if (null !== $criteria) { - if (false !== $this->collBlockVersionsPartial && count($collBlockVersions)) { - $this->initBlockVersions(false); - - foreach ($collBlockVersions as $obj) { - if (false == $this->collBlockVersions->contains($obj)) { - $this->collBlockVersions->append($obj); - } - } - - $this->collBlockVersionsPartial = true; - } - - $collBlockVersions->getInternalIterator()->rewind(); - - return $collBlockVersions; - } - - if ($partial && $this->collBlockVersions) { - foreach ($this->collBlockVersions as $obj) { - if ($obj->isNew()) { - $collBlockVersions[] = $obj; - } - } - } - - $this->collBlockVersions = $collBlockVersions; - $this->collBlockVersionsPartial = false; - } - } - - return $this->collBlockVersions; - } - - /** - * Sets a collection of BlockVersion objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param PropelCollection $blockVersions A Propel collection. - * @param PropelPDO $con Optional connection object - * @return Block The current object (for fluent API support) - */ - public function setBlockVersions(PropelCollection $blockVersions, PropelPDO $con = null) - { - $blockVersionsToDelete = $this->getBlockVersions(new Criteria(), $con)->diff($blockVersions); - - - //since at least one column in the foreign key is at the same time a PK - //we can not just set a PK to NULL in the lines below. We have to store - //a backup of all values, so we are able to manipulate these items based on the onDelete value later. - $this->blockVersionsScheduledForDeletion = clone $blockVersionsToDelete; - - foreach ($blockVersionsToDelete as $blockVersionRemoved) { - $blockVersionRemoved->setBlock(null); - } - - $this->collBlockVersions = null; - foreach ($blockVersions as $blockVersion) { - $this->addBlockVersion($blockVersion); - } - - $this->collBlockVersions = $blockVersions; - $this->collBlockVersionsPartial = false; - - return $this; - } - - /** - * Returns the number of related BlockVersion objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related BlockVersion objects. - * @throws PropelException - */ - public function countBlockVersions(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - $partial = $this->collBlockVersionsPartial && !$this->isNew(); - if (null === $this->collBlockVersions || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collBlockVersions) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getBlockVersions()); - } - $query = BlockVersionQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByBlock($this) - ->count($con); - } - - return count($this->collBlockVersions); - } - - /** - * Method called to associate a BaseBlockVersion object to this object - * through the BaseBlockVersion foreign key attribute. - * - * @param BaseBlockVersion $l BaseBlockVersion - * @return Block The current object (for fluent API support) - */ - public function addBlockVersion(BaseBlockVersion $l) - { - if ($this->collBlockVersions === null) { - $this->initBlockVersions(); - $this->collBlockVersionsPartial = true; - } - - if (!in_array($l, $this->collBlockVersions->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddBlockVersion($l); - - if ($this->blockVersionsScheduledForDeletion and $this->blockVersionsScheduledForDeletion->contains($l)) { - $this->blockVersionsScheduledForDeletion->remove($this->blockVersionsScheduledForDeletion->search($l)); - } - } - - return $this; - } - - /** - * @param BlockVersion $blockVersion The blockVersion object to add. - */ - protected function doAddBlockVersion($blockVersion) - { - $this->collBlockVersions[]= $blockVersion; - $blockVersion->setBlock($this); - } - - /** - * @param BlockVersion $blockVersion The blockVersion object to remove. - * @return Block The current object (for fluent API support) - */ - public function removeBlockVersion($blockVersion) - { - if ($this->getBlockVersions()->contains($blockVersion)) { - $this->collBlockVersions->remove($this->collBlockVersions->search($blockVersion)); - if (null === $this->blockVersionsScheduledForDeletion) { - $this->blockVersionsScheduledForDeletion = clone $this->collBlockVersions; - $this->blockVersionsScheduledForDeletion->clear(); - } - $this->blockVersionsScheduledForDeletion[]= clone $blockVersion; - $blockVersion->setBlock(null); - } - - return $this; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->name = null; - $this->value = null; - $this->class_key = null; - $this->template = null; - $this->model_id = null; - $this->created_at = null; - $this->updated_at = null; - $this->version = null; - $this->version_created_at = null; - $this->version_created_by = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->alreadyInClearAllReferencesDeep = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $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-volume/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep && !$this->alreadyInClearAllReferencesDeep) { - $this->alreadyInClearAllReferencesDeep = true; - if ($this->collBlockVersions) { - foreach ($this->collBlockVersions as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->aModel instanceof Persistent) { - $this->aModel->clearAllReferences($deep); - } - - $this->alreadyInClearAllReferencesDeep = false; - } // if ($deep) - - if ($this->collBlockVersions instanceof PropelCollection) { - $this->collBlockVersions->clearIterator(); - } - $this->collBlockVersions = null; - $this->aModel = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(BlockPeer::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 Block The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = BlockPeer::UPDATED_AT; - - return $this; - } - - // versionable behavior - - /** - * Enforce a new Version of this object upon next save. - * - * @return Block - */ - public function enforceVersioning() - { - $this->enforceVersion = true; - - return $this; - } - - /** - * Checks whether the current state must be recorded as a version - * - * @param PropelPDO $con An optional PropelPDO connection to use. - * - * @return boolean - */ - public function isVersioningNecessary($con = null) - { - if ($this->alreadyInSave) { - return false; - } - - if ($this->enforceVersion) { - return true; - } - - if (BlockPeer::isVersioningEnabled() && ($this->isNew() || $this->isModified() || $this->isDeleted())) { - return true; - } - if (null !== ($object = $this->getModel($con)) && $object->isVersioningNecessary($con)) { - return true; - } - - - return false; - } - - /** - * Creates a version of the current object and saves it. - * - * @param PropelPDO $con the connection to use - * - * @return BlockVersion A version object - */ - public function addVersion($con = null) - { - $this->enforceVersion = false; - - $version = new BlockVersion(); - $version->setId($this->getId()); - $version->setName($this->getName()); - $version->setValue($this->getValue()); - $version->setClassKey($this->getClassKey()); - $version->setTemplate($this->getTemplate()); - $version->setModelId($this->getModelId()); - $version->setCreatedAt($this->getCreatedAt()); - $version->setUpdatedAt($this->getUpdatedAt()); - $version->setVersion($this->getVersion()); - $version->setVersionCreatedAt($this->getVersionCreatedAt()); - $version->setVersionCreatedBy($this->getVersionCreatedBy()); - $version->setBlock($this); - if (($related = $this->getModel($con)) && $related->getVersion()) { - $version->setModelIdVersion($related->getVersion()); - } - $version->save($con); - - return $version; - } - - /** - * Sets the properties of the current object to the value they had at a specific version - * - * @param integer $versionNumber The version number to read - * @param PropelPDO $con the connection to use - * - * @return Block The current object (for fluent API support) - * @throws PropelException - if no object with the given version can be found. - */ - public function toVersion($versionNumber, $con = null) - { - $version = $this->getOneVersion($versionNumber, $con); - if (!$version) { - throw new PropelException(sprintf('No Block object found with version %d', $versionNumber)); - } - $this->populateFromVersion($version, $con); - - return $this; - } - - /** - * Sets the properties of the curent object to the value they had at a specific version - * - * @param BlockVersion $version The version object to use - * @param PropelPDO $con the connection to use - * @param array $loadedObjects objects thats been loaded in a chain of populateFromVersion calls on referrer or fk objects. - * - * @return Block The current object (for fluent API support) - */ - public function populateFromVersion($version, $con = null, &$loadedObjects = array()) - { - - $loadedObjects['Block'][$version->getId()][$version->getVersion()] = $this; - $this->setId($version->getId()); - $this->setName($version->getName()); - $this->setValue($version->getValue()); - $this->setClassKey($version->getClassKey()); - $this->setTemplate($version->getTemplate()); - $this->setModelId($version->getModelId()); - $this->setCreatedAt($version->getCreatedAt()); - $this->setUpdatedAt($version->getUpdatedAt()); - $this->setVersion($version->getVersion()); - $this->setVersionCreatedAt($version->getVersionCreatedAt()); - $this->setVersionCreatedBy($version->getVersionCreatedBy()); - if ($fkValue = $version->getModelId()) { - if (isset($loadedObjects['Model']) && isset($loadedObjects['Model'][$fkValue]) && isset($loadedObjects['Model'][$fkValue][$version->getModelIdVersion()])) { - $related = $loadedObjects['Model'][$fkValue][$version->getModelIdVersion()]; - } else { - $related = new Model(); - $relatedVersion = ModelVersionQuery::create() - ->filterById($fkValue) - ->filterByVersion($version->getModelIdVersion()) - ->findOne($con); - $related->populateFromVersion($relatedVersion, $con, $loadedObjects); - $related->setNew(false); - } - $this->setModel($related); - } - - return $this; - } - - /** - * Gets the latest persisted version number for the current object - * - * @param PropelPDO $con the connection to use - * - * @return integer - */ - public function getLastVersionNumber($con = null) - { - $v = BlockVersionQuery::create() - ->filterByBlock($this) - ->orderByVersion('desc') - ->findOne($con); - if (!$v) { - return 0; - } - - return $v->getVersion(); - } - - /** - * Checks whether the current object is the latest one - * - * @param PropelPDO $con the connection to use - * - * @return boolean - */ - public function isLastVersion($con = null) - { - return $this->getLastVersionNumber($con) == $this->getVersion(); - } - - /** - * Retrieves a version object for this entity and a version number - * - * @param integer $versionNumber The version number to read - * @param PropelPDO $con the connection to use - * - * @return BlockVersion A version object - */ - public function getOneVersion($versionNumber, $con = null) - { - return BlockVersionQuery::create() - ->filterByBlock($this) - ->filterByVersion($versionNumber) - ->findOne($con); - } - - /** - * Gets all the versions of this object, in incremental order - * - * @param PropelPDO $con the connection to use - * - * @return PropelObjectCollection A list of BlockVersion objects - */ - public function getAllVersions($con = null) - { - $criteria = new Criteria(); - $criteria->addAscendingOrderByColumn(BlockVersionPeer::VERSION); - - return $this->getBlockVersions($criteria, $con); - } - - /** - * Compares the current object with another of its version. - * - * print_r($book->compareVersion(1)); - * => array( - * '1' => array('Title' => 'Book title at version 1'), - * '2' => array('Title' => 'Book title at version 2') - * ); - * - * - * @param integer $versionNumber - * @param string $keys Main key used for the result diff (versions|columns) - * @param PropelPDO $con the connection to use - * @param array $ignoredColumns The columns to exclude from the diff. - * - * @return array A list of differences - */ - public function compareVersion($versionNumber, $keys = 'columns', $con = null, $ignoredColumns = array()) - { - $fromVersion = $this->toArray(); - $toVersion = $this->getOneVersion($versionNumber, $con)->toArray(); - - return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns); - } - - /** - * Compares two versions of the current object. - * - * print_r($book->compareVersions(1, 2)); - * => array( - * '1' => array('Title' => 'Book title at version 1'), - * '2' => array('Title' => 'Book title at version 2') - * ); - * - * - * @param integer $fromVersionNumber - * @param integer $toVersionNumber - * @param string $keys Main key used for the result diff (versions|columns) - * @param PropelPDO $con the connection to use - * @param array $ignoredColumns The columns to exclude from the diff. - * - * @return array A list of differences - */ - public function compareVersions($fromVersionNumber, $toVersionNumber, $keys = 'columns', $con = null, $ignoredColumns = array()) - { - $fromVersion = $this->getOneVersion($fromVersionNumber, $con)->toArray(); - $toVersion = $this->getOneVersion($toVersionNumber, $con)->toArray(); - - return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns); - } - - /** - * Computes the diff between two versions. - * - * print_r($this->computeDiff(1, 2)); - * => array( - * '1' => array('Title' => 'Book title at version 1'), - * '2' => array('Title' => 'Book title at version 2') - * ); - * - * - * @param array $fromVersion An array representing the original version. - * @param array $toVersion An array representing the destination version. - * @param string $keys Main key used for the result diff (versions|columns). - * @param array $ignoredColumns The columns to exclude from the diff. - * - * @return array A list of differences - */ - protected function computeDiff($fromVersion, $toVersion, $keys = 'columns', $ignoredColumns = array()) - { - $fromVersionNumber = $fromVersion['Version']; - $toVersionNumber = $toVersion['Version']; - $ignoredColumns = array_merge(array( - 'Version', - 'VersionCreatedAt', - 'VersionCreatedBy', - ), $ignoredColumns); - $diff = array(); - foreach ($fromVersion as $key => $value) { - if (in_array($key, $ignoredColumns)) { - continue; - } - if ($toVersion[$key] != $value) { - switch ($keys) { - case 'versions': - $diff[$fromVersionNumber][$key] = $value; - $diff[$toVersionNumber][$key] = $toVersion[$key]; - break; - default: - $diff[$key] = array( - $fromVersionNumber => $value, - $toVersionNumber => $toVersion[$key], - ); - break; - } - } - } - - return $diff; - } - /** - * retrieve the last $number versions. - * - * @param integer $number the number of record to return. - * @param BlockVersionQuery|Criteria $criteria Additional criteria to filter. - * @param PropelPDO $con An optional connection to use. - * - * @return PropelCollection|BlockVersion[] List of BlockVersion objects - */ - public function getLastVersions($number = 10, $criteria = null, PropelPDO $con = null) - { - $criteria = BlockVersionQuery::create(null, $criteria); - $criteria->addDescendingOrderByColumn(BlockVersionPeer::VERSION); - $criteria->limit($number); - - return $this->getBlockVersions($criteria, $con); - } - // event behavior - public function preCommit(\PropelPDO $con = null){} - public function preCommitSave(\PropelPDO $con = null){} - public function preCommitDelete(\PropelPDO $con = null){} - public function preCommitUpdate(\PropelPDO $con = null){} - public function preCommitInsert(\PropelPDO $con = null){} - public function preRollback(\PropelPDO $con = null){} - public function preRollbackSave(\PropelPDO $con = null){} - public function preRollbackDelete(\PropelPDO $con = null){} - public function preRollbackUpdate(\PropelPDO $con = null){} - public function preRollbackInsert(\PropelPDO $con = null){} - -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockPeer.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockPeer.php deleted file mode 100644 index b73a71c..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockPeer.php +++ /dev/null @@ -1,1158 +0,0 @@ - array ('Id', 'Name', 'Value', 'ClassKey', 'Template', 'ModelId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'value', 'classKey', 'template', 'modelId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), - BasePeer::TYPE_COLNAME => array (BlockPeer::ID, BlockPeer::NAME, BlockPeer::VALUE, BlockPeer::CLASS_KEY, BlockPeer::TEMPLATE, BlockPeer::MODEL_ID, BlockPeer::CREATED_AT, BlockPeer::UPDATED_AT, BlockPeer::VERSION, BlockPeer::VERSION_CREATED_AT, BlockPeer::VERSION_CREATED_BY, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'VALUE', 'CLASS_KEY', 'TEMPLATE', 'MODEL_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'value', 'class_key', 'template', 'model_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. BlockPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'Value' => 2, 'ClassKey' => 3, 'Template' => 4, 'ModelId' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, 'Version' => 8, 'VersionCreatedAt' => 9, 'VersionCreatedBy' => 10, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'value' => 2, 'classKey' => 3, 'template' => 4, 'modelId' => 5, 'createdAt' => 6, 'updatedAt' => 7, 'version' => 8, 'versionCreatedAt' => 9, 'versionCreatedBy' => 10, ), - BasePeer::TYPE_COLNAME => array (BlockPeer::ID => 0, BlockPeer::NAME => 1, BlockPeer::VALUE => 2, BlockPeer::CLASS_KEY => 3, BlockPeer::TEMPLATE => 4, BlockPeer::MODEL_ID => 5, BlockPeer::CREATED_AT => 6, BlockPeer::UPDATED_AT => 7, BlockPeer::VERSION => 8, BlockPeer::VERSION_CREATED_AT => 9, BlockPeer::VERSION_CREATED_BY => 10, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'VALUE' => 2, 'CLASS_KEY' => 3, 'TEMPLATE' => 4, 'MODEL_ID' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, 'VERSION' => 8, 'VERSION_CREATED_AT' => 9, 'VERSION_CREATED_BY' => 10, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'value' => 2, 'class_key' => 3, 'template' => 4, 'model_id' => 5, 'created_at' => 6, 'updated_at' => 7, 'version' => 8, 'version_created_at' => 9, 'version_created_by' => 10, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) - ); - - /** - * 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 = BlockPeer::getFieldNames($toType); - $key = isset(BlockPeer::$fieldKeys[$fromType][$name]) ? BlockPeer::$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(BlockPeer::$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, BlockPeer::$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 BlockPeer::$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. BlockPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(BlockPeer::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(BlockPeer::ID); - $criteria->addSelectColumn(BlockPeer::NAME); - $criteria->addSelectColumn(BlockPeer::VALUE); - $criteria->addSelectColumn(BlockPeer::CLASS_KEY); - $criteria->addSelectColumn(BlockPeer::TEMPLATE); - $criteria->addSelectColumn(BlockPeer::MODEL_ID); - $criteria->addSelectColumn(BlockPeer::CREATED_AT); - $criteria->addSelectColumn(BlockPeer::UPDATED_AT); - $criteria->addSelectColumn(BlockPeer::VERSION); - $criteria->addSelectColumn(BlockPeer::VERSION_CREATED_AT); - $criteria->addSelectColumn(BlockPeer::VERSION_CREATED_BY); - } else { - $criteria->addSelectColumn($alias . '.id'); - $criteria->addSelectColumn($alias . '.name'); - $criteria->addSelectColumn($alias . '.value'); - $criteria->addSelectColumn($alias . '.class_key'); - $criteria->addSelectColumn($alias . '.template'); - $criteria->addSelectColumn($alias . '.model_id'); - $criteria->addSelectColumn($alias . '.created_at'); - $criteria->addSelectColumn($alias . '.updated_at'); - $criteria->addSelectColumn($alias . '.version'); - $criteria->addSelectColumn($alias . '.version_created_at'); - $criteria->addSelectColumn($alias . '.version_created_by'); - } - } - - /** - * 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(BlockPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - BlockPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(BlockPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(BlockPeer::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 Block - * @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 = BlockPeer::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 BlockPeer::populateObjects(BlockPeer::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 directly (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(BlockPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - BlockPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(BlockPeer::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 Block $obj A Block 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 - BlockPeer::$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 Block 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 Block) { - $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 Block object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(BlockPeer::$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 Block 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(BlockPeer::$instances[$key])) { - return BlockPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool($and_clear_all_references = false) - { - if ($and_clear_all_references) { - foreach (BlockPeer::$instances as $instance) { - $instance->clearAllReferences(true); - } - } - BlockPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to nws_block - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - // Invalidate objects in BlockVersionPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - BlockVersionPeer::clearInstancePool(); - } - - /** - * 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(); - - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = BlockPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = BlockPeer::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 { - // class must be set each time from the record row - $cls = BlockPeer::getOMClass($row, 0); - $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - BlockPeer::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 (Block object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = BlockPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = BlockPeer::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 + BlockPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = BlockPeer::getOMClass($row, $startcol); - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - BlockPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Model 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 doCountJoinModel(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(BlockPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - BlockPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(BlockPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(BlockPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(BlockPeer::MODEL_ID, ModelPeer::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 Block objects pre-filled with their Model 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 Block objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinModel(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(BlockPeer::DATABASE_NAME); - } - - BlockPeer::addSelectColumns($criteria); - $startcol = BlockPeer::NUM_HYDRATE_COLUMNS; - ModelPeer::addSelectColumns($criteria); - - $criteria->addJoin(BlockPeer::MODEL_ID, ModelPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = BlockPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = BlockPeer::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 { - - $omClass = BlockPeer::getOMClass($row, 0); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj1 = new $cls(); - $obj1->hydrate($row); - BlockPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = ModelPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = ModelPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $omClass = ModelPeer::getOMClass($row, $startcol); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - ModelPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (Block) to $obj2 (Model) - $obj2->addBlock($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(BlockPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - BlockPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(BlockPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(BlockPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(BlockPeer::MODEL_ID, ModelPeer::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 Block 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 Block 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(BlockPeer::DATABASE_NAME); - } - - BlockPeer::addSelectColumns($criteria); - $startcol2 = BlockPeer::NUM_HYDRATE_COLUMNS; - - ModelPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + ModelPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(BlockPeer::MODEL_ID, ModelPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = BlockPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = BlockPeer::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 { - $omClass = BlockPeer::getOMClass($row, 0); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj1 = new $cls(); - $obj1->hydrate($row); - BlockPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Model rows - - $key2 = ModelPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = ModelPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $omClass = ModelPeer::getOMClass($row, $startcol2); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - ModelPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (Block) to the collection in $obj2 (Model) - $obj2->addBlock($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(BlockPeer::DATABASE_NAME)->getTable(BlockPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseBlockPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseBlockPeer::TABLE_NAME)) { - $dbMap->addTableObject(new \Trinity\Bundle\NewsletterBundle\Model\map\BlockTableMap()); - } - } - - /** - * The returned Class will contain objects of the default type or - * objects that inherit from the default. - * - * @param array $row PropelPDO result row. - * @param int $colnum Column to examine for OM class information (first is 0). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getOMClass($row = 0, $colnum = 0) - { - try { - - $omClass = $row[$colnum + 3]; - $omClass = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - } catch (Exception $e) { - throw new PropelException('Unable to get OM class.', $e); - } - - - $event = new DetectOMClassEvent($omClass); - EventDispatcherProxy::trigger('om.detect', $event); - if($event->isDetected()){ - return $event->getDetectedClass(); - } - - return $omClass; - } - - /** - * Performs an INSERT on the database, given a Block or Criteria object. - * - * @param mixed $values Criteria or Block 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(BlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Block object - } - - if ($criteria->containsKey(BlockPeer::ID) && $criteria->keyContainsValue(BlockPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.BlockPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(BlockPeer::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 (Exception $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a Block or Criteria object. - * - * @param mixed $values Criteria or Block 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(BlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(BlockPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(BlockPeer::ID); - $value = $criteria->remove(BlockPeer::ID); - if ($value) { - $selectCriteria->add(BlockPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(BlockPeer::TABLE_NAME); - } - - } else { // $values is Block object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(BlockPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the nws_block 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(BlockPeer::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 += BlockPeer::doOnDeleteCascade(new Criteria(BlockPeer::DATABASE_NAME), $con); - $affectedRows += BasePeer::doDeleteAll(BlockPeer::TABLE_NAME, $con, BlockPeer::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). - BlockPeer::clearInstancePool(); - BlockPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a Block or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Block 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(BlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof Block) { // it's a model object - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(BlockPeer::DATABASE_NAME); - $criteria->add(BlockPeer::ID, (array) $values, Criteria::IN); - } - - // Set the correct dbName - $criteria->setDbName(BlockPeer::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(); - - // cloning the Criteria in case it's modified by doSelect() or doSelectStmt() - $c = clone $criteria; - $affectedRows += BlockPeer::doOnDeleteCascade($c, $con); - - // 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). - if ($values instanceof Criteria) { - BlockPeer::clearInstancePool(); - } elseif ($values instanceof Block) { // it's a model object - BlockPeer::removeInstanceFromPool($values); - } else { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { - BlockPeer::removeInstanceFromPool($singleval); - } - } - - $affectedRows += BasePeer::doDelete($criteria, $con); - BlockPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * This is a method for emulating ON DELETE CASCADE for DBs that don't support this - * feature (like MySQL or SQLite). - * - * This method is not very speedy because it must perform a query first to get - * the implicated records and then perform the deletes by calling those Peer classes. - * - * This method should be used within a transaction if possible. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @return int The number of affected rows (if supported by underlying database driver). - */ - protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) - { - // initialize var to track total num of affected rows - $affectedRows = 0; - - // first find the objects that are implicated by the $criteria - $objects = BlockPeer::doSelect($criteria, $con); - foreach ($objects as $obj) { - - - // delete related BlockVersion objects - $criteria = new Criteria(BlockVersionPeer::DATABASE_NAME); - - $criteria->add(BlockVersionPeer::ID, $obj->getId()); - $affectedRows += BlockVersionPeer::doDelete($criteria, $con); - } - - return $affectedRows; - } - - /** - * Validates all modified columns of given Block 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 Block $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(BlockPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(BlockPeer::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(BlockPeer::DATABASE_NAME, BlockPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return Block - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = BlockPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(BlockPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(BlockPeer::DATABASE_NAME); - $criteria->add(BlockPeer::ID, $pk); - - $v = BlockPeer::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 Block[] - * @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(BlockPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(BlockPeer::DATABASE_NAME); - $criteria->add(BlockPeer::ID, $pks, Criteria::IN); - $objs = BlockPeer::doSelect($criteria, $con); - } - - return $objs; - } - - // versionable behavior - - /** - * Checks whether versioning is enabled - * - * @return boolean - */ - public static function isVersioningEnabled() - { - return self::$isVersioningEnabled; - } - - /** - * Enables versioning - */ - public static function enableVersioning() - { - self::$isVersioningEnabled = true; - } - - /** - * Disables versioning - */ - public static function disableVersioning() - { - self::$isVersioningEnabled = false; - } - -} // BaseBlockPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseBlockPeer::buildTableMap(); - -EventDispatcherProxy::trigger(array('construct','peer.construct'), new PeerEvent('Trinity\Bundle\NewsletterBundle\Model\om\BaseBlockPeer')); diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockQuery.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockQuery.php deleted file mode 100644 index c1552e8..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockQuery.php +++ /dev/null @@ -1,992 +0,0 @@ -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 Block|Block[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = BlockPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is already in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(BlockPeer::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); - } - } - - /** - * Alias of findPk to use instance pooling - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return Block A model object, or null if the key is not found - * @throws PropelException - */ - public function findOneById($key, $con = null) - { - return $this->findPk($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 Block A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `id`, `name`, `value`, `class_key`, `template`, `model_id`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by` FROM `nws_block` 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)) { - $cls = BlockPeer::getOMClass($row, 0); - $obj = new $cls(); - $obj->hydrate($row); - BlockPeer::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 Block|Block[]|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|Block[]|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 BlockQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(BlockPeer::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 BlockQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(BlockPeer::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 - * $query->filterById(array('max' => 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 BlockQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id)) { - $useMinMax = false; - if (isset($id['min'])) { - $this->addUsingAlias(BlockPeer::ID, $id['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($id['max'])) { - $this->addUsingAlias(BlockPeer::ID, $id['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the name column - * - * Example usage: - * - * $query->filterByName('fooValue'); // WHERE name = 'fooValue' - * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' - * - * - * @param string $name 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 BlockQuery The current query, for fluid interface - */ - public function filterByName($name = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($name)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $name)) { - $name = str_replace('*', '%', $name); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(BlockPeer::NAME, $name, $comparison); - } - - /** - * Filter the query on the value column - * - * Example usage: - * - * $query->filterByValue('fooValue'); // WHERE value = 'fooValue' - * $query->filterByValue('%fooValue%'); // WHERE value LIKE '%fooValue%' - * - * - * @param string $value 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 BlockQuery The current query, for fluid interface - */ - public function filterByValue($value = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($value)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $value)) { - $value = str_replace('*', '%', $value); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(BlockPeer::VALUE, $value, $comparison); - } - - /** - * Filter the query on the class_key column - * - * Example usage: - * - * $query->filterByClassKey('fooValue'); // WHERE class_key = 'fooValue' - * $query->filterByClassKey('%fooValue%'); // WHERE class_key LIKE '%fooValue%' - * - * - * @param string $classKey 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 BlockQuery The current query, for fluid interface - */ - public function filterByClassKey($classKey = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($classKey)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $classKey)) { - $classKey = str_replace('*', '%', $classKey); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(BlockPeer::CLASS_KEY, $classKey, $comparison); - } - - /** - * Filter the query on the template column - * - * Example usage: - * - * $query->filterByTemplate('fooValue'); // WHERE template = 'fooValue' - * $query->filterByTemplate('%fooValue%'); // WHERE template LIKE '%fooValue%' - * - * - * @param string $template 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 BlockQuery The current query, for fluid interface - */ - public function filterByTemplate($template = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($template)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $template)) { - $template = str_replace('*', '%', $template); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(BlockPeer::TEMPLATE, $template, $comparison); - } - - /** - * Filter the query on the model_id column - * - * Example usage: - * - * $query->filterByModelId(1234); // WHERE model_id = 1234 - * $query->filterByModelId(array(12, 34)); // WHERE model_id IN (12, 34) - * $query->filterByModelId(array('min' => 12)); // WHERE model_id >= 12 - * $query->filterByModelId(array('max' => 12)); // WHERE model_id <= 12 - * - * - * @see filterByModel() - * - * @param mixed $modelId 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 BlockQuery The current query, for fluid interface - */ - public function filterByModelId($modelId = null, $comparison = null) - { - if (is_array($modelId)) { - $useMinMax = false; - if (isset($modelId['min'])) { - $this->addUsingAlias(BlockPeer::MODEL_ID, $modelId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($modelId['max'])) { - $this->addUsingAlias(BlockPeer::MODEL_ID, $modelId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockPeer::MODEL_ID, $modelId, $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 BlockQuery 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(BlockPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(BlockPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockPeer::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 BlockQuery 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(BlockPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(BlockPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query on the version column - * - * Example usage: - * - * $query->filterByVersion(1234); // WHERE version = 1234 - * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34) - * $query->filterByVersion(array('min' => 12)); // WHERE version >= 12 - * $query->filterByVersion(array('max' => 12)); // WHERE version <= 12 - * - * - * @param mixed $version 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 BlockQuery The current query, for fluid interface - */ - public function filterByVersion($version = null, $comparison = null) - { - if (is_array($version)) { - $useMinMax = false; - if (isset($version['min'])) { - $this->addUsingAlias(BlockPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($version['max'])) { - $this->addUsingAlias(BlockPeer::VERSION, $version['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockPeer::VERSION, $version, $comparison); - } - - /** - * Filter the query on the version_created_at column - * - * Example usage: - * - * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14' - * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14' - * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at < '2011-03-13' - * - * - * @param mixed $versionCreatedAt 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 BlockQuery The current query, for fluid interface - */ - public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null) - { - if (is_array($versionCreatedAt)) { - $useMinMax = false; - if (isset($versionCreatedAt['min'])) { - $this->addUsingAlias(BlockPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($versionCreatedAt['max'])) { - $this->addUsingAlias(BlockPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison); - } - - /** - * Filter the query on the version_created_by column - * - * Example usage: - * - * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue' - * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%' - * - * - * @param string $versionCreatedBy 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 BlockQuery The current query, for fluid interface - */ - public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($versionCreatedBy)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) { - $versionCreatedBy = str_replace('*', '%', $versionCreatedBy); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(BlockPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison); - } - - /** - * Filter the query by a related Model object - * - * @param Model|PropelObjectCollection $model The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return BlockQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByModel($model, $comparison = null) - { - if ($model instanceof Model) { - return $this - ->addUsingAlias(BlockPeer::MODEL_ID, $model->getId(), $comparison); - } elseif ($model instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(BlockPeer::MODEL_ID, $model->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByModel() only accepts arguments of type Model or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Model relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return BlockQuery The current query, for fluid interface - */ - public function joinModel($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Model'); - - // 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, 'Model'); - } - - return $this; - } - - /** - * Use the Model relation Model 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 \Trinity\Bundle\NewsletterBundle\Model\ModelQuery A secondary query class using the current class as primary query - */ - public function useModelQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinModel($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Model', '\Trinity\Bundle\NewsletterBundle\Model\ModelQuery'); - } - - /** - * Filter the query by a related BlockVersion object - * - * @param BlockVersion|PropelObjectCollection $blockVersion the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return BlockQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByBlockVersion($blockVersion, $comparison = null) - { - if ($blockVersion instanceof BlockVersion) { - return $this - ->addUsingAlias(BlockPeer::ID, $blockVersion->getId(), $comparison); - } elseif ($blockVersion instanceof PropelObjectCollection) { - return $this - ->useBlockVersionQuery() - ->filterByPrimaryKeys($blockVersion->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByBlockVersion() only accepts arguments of type BlockVersion or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the BlockVersion relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return BlockQuery The current query, for fluid interface - */ - public function joinBlockVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('BlockVersion'); - - // 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, 'BlockVersion'); - } - - return $this; - } - - /** - * Use the BlockVersion relation BlockVersion 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 \Trinity\Bundle\NewsletterBundle\Model\BlockVersionQuery A secondary query class using the current class as primary query - */ - public function useBlockVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinBlockVersion($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'BlockVersion', '\Trinity\Bundle\NewsletterBundle\Model\BlockVersionQuery'); - } - - /** - * Exclude object from result - * - * @param Block $block Object to remove from the list of results - * - * @return BlockQuery The current query, for fluid interface - */ - public function prune($block = null) - { - if ($block) { - $this->addUsingAlias(BlockPeer::ID, $block->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - /** - * Code to execute before every SELECT statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreSelect(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger('query.select.pre', new QueryEvent($this)); - - return $this->preSelect($con); - } - - /** - * Code to execute before every DELETE statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreDelete(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','query.delete.pre'), new QueryEvent($this)); - - return $this->preDelete($con); - } - - /** - * Code to execute after every DELETE statement - * - * @param int $affectedRows the number of deleted rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostDelete($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.post','query.delete.post'), new QueryEvent($this)); - - return $this->postDelete($affectedRows, $con); - } - - /** - * Code to execute before every UPDATE statement - * - * @param array $values The associative array of columns and values for the update - * @param PropelPDO $con The connection object used by the query - * @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), otherwise it is a series of save() calls on all the found objects - */ - protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false) - { - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'query.update.pre'), new QueryEvent($this)); - - return $this->preUpdate($values, $con, $forceIndividualSaves); - } - - /** - * Code to execute after every UPDATE statement - * - * @param int $affectedRows the number of updated rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostUpdate($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'query.update.post'), new QueryEvent($this)); - - return $this->postUpdate($affectedRows, $con); - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return BlockQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(BlockPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return BlockQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(BlockPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return BlockQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(BlockPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return BlockQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(BlockPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return BlockQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(BlockPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return BlockQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(BlockPeer::CREATED_AT); - } - // extend behavior - public function setFormatter($formatter) - { - if (is_string($formatter) && $formatter === \ModelCriteria::FORMAT_ON_DEMAND) { - $formatter = '\Glorpen\Propel\PropelBundle\Formatter\PropelOnDemandFormatter'; - } - - return parent::setFormatter($formatter); - } -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockVersion.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockVersion.php deleted file mode 100644 index 64f66c0..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockVersion.php +++ /dev/null @@ -1,1660 +0,0 @@ -version = 0; - $this->model_id_version = 0; - } - - /** - * Initializes internal state of BaseBlockVersion object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - EventDispatcherProxy::trigger(array('construct','model.construct'), new ModelEvent($this)); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getId() - { - - return $this->id; - } - - /** - * Get the [name] column value. - * - * @return string - */ - public function getName() - { - - return $this->name; - } - - /** - * Get the [value] column value. - * - * @return string - */ - public function getValue() - { - - return $this->value; - } - - /** - * Get the [class_key] column value. - * - * @return string - */ - public function getClassKey() - { - - return $this->class_key; - } - - /** - * Get the [template] column value. - * - * @return string - */ - public function getTemplate() - { - - return $this->template; - } - - /** - * Get the [model_id] column value. - * - * @return int - */ - public function getModelId() - { - - return $this->model_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 = null) - { - 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; - } - - 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; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - 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 = null) - { - 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; - } - - 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; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * Get the [version] column value. - * - * @return int - */ - public function getVersion() - { - - return $this->version; - } - - /** - * Get the [optionally formatted] temporal [version_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 getVersionCreatedAt($format = null) - { - if ($this->version_created_at === null) { - return null; - } - - if ($this->version_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; - } - - try { - $dt = new DateTime($this->version_created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * Get the [version_created_by] column value. - * - * @return string - */ - public function getVersionCreatedBy() - { - - return $this->version_created_by; - } - - /** - * Get the [model_id_version] column value. - * - * @return int - */ - public function getModelIdVersion() - { - - return $this->model_id_version; - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return BlockVersion The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = BlockVersionPeer::ID; - } - - if ($this->aBlock !== null && $this->aBlock->getId() !== $v) { - $this->aBlock = null; - } - - - return $this; - } // setId() - - /** - * Set the value of [name] column. - * - * @param string $v new value - * @return BlockVersion The current object (for fluent API support) - */ - public function setName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->name !== $v) { - $this->name = $v; - $this->modifiedColumns[] = BlockVersionPeer::NAME; - } - - - return $this; - } // setName() - - /** - * Set the value of [value] column. - * - * @param string $v new value - * @return BlockVersion The current object (for fluent API support) - */ - public function setValue($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->value !== $v) { - $this->value = $v; - $this->modifiedColumns[] = BlockVersionPeer::VALUE; - } - - - return $this; - } // setValue() - - /** - * Set the value of [class_key] column. - * - * @param string $v new value - * @return BlockVersion The current object (for fluent API support) - */ - public function setClassKey($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->class_key !== $v) { - $this->class_key = $v; - $this->modifiedColumns[] = BlockVersionPeer::CLASS_KEY; - } - - - return $this; - } // setClassKey() - - /** - * Set the value of [template] column. - * - * @param string $v new value - * @return BlockVersion The current object (for fluent API support) - */ - public function setTemplate($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->template !== $v) { - $this->template = $v; - $this->modifiedColumns[] = BlockVersionPeer::TEMPLATE; - } - - - return $this; - } // setTemplate() - - /** - * Set the value of [model_id] column. - * - * @param int $v new value - * @return BlockVersion The current object (for fluent API support) - */ - public function setModelId($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->model_id !== $v) { - $this->model_id = $v; - $this->modifiedColumns[] = BlockVersionPeer::MODEL_ID; - } - - - return $this; - } // setModelId() - - /** - * 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 BlockVersion 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[] = BlockVersionPeer::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 BlockVersion 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[] = BlockVersionPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Set the value of [version] column. - * - * @param int $v new value - * @return BlockVersion The current object (for fluent API support) - */ - public function setVersion($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->version !== $v) { - $this->version = $v; - $this->modifiedColumns[] = BlockVersionPeer::VERSION; - } - - - return $this; - } // setVersion() - - /** - * Sets the value of [version_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 BlockVersion The current object (for fluent API support) - */ - public function setVersionCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->version_created_at !== null || $dt !== null) { - $currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_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->version_created_at = $newDateAsString; - $this->modifiedColumns[] = BlockVersionPeer::VERSION_CREATED_AT; - } - } // if either are not null - - - return $this; - } // setVersionCreatedAt() - - /** - * Set the value of [version_created_by] column. - * - * @param string $v new value - * @return BlockVersion The current object (for fluent API support) - */ - public function setVersionCreatedBy($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->version_created_by !== $v) { - $this->version_created_by = $v; - $this->modifiedColumns[] = BlockVersionPeer::VERSION_CREATED_BY; - } - - - return $this; - } // setVersionCreatedBy() - - /** - * Set the value of [model_id_version] column. - * - * @param int $v new value - * @return BlockVersion The current object (for fluent API support) - */ - public function setModelIdVersion($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->model_id_version !== $v) { - $this->model_id_version = $v; - $this->modifiedColumns[] = BlockVersionPeer::MODEL_ID_VERSION; - } - - - return $this; - } // setModelIdVersion() - - /** - * 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() - { - if ($this->version !== 0) { - return false; - } - - if ($this->model_id_version !== 0) { - return false; - } - - // 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 resultset 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->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->value = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->class_key = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->template = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->model_id = ($row[$startcol + 5] !== null) ? (int) $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->version = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; - $this->version_created_at = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; - $this->version_created_by = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; - $this->model_id_version = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - $this->postHydrate($row, $startcol, $rehydrate); - - return $startcol + 12; // 12 = BlockVersionPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating BlockVersion 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->aBlock !== null && $this->id !== $this->aBlock->getId()) { - $this->aBlock = 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(BlockVersionPeer::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 = BlockVersionPeer::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->aBlock = 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(BlockVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = BlockVersionQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','model.delete.pre'), new ModelEvent($this)); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.post', 'model.delete.post'), new ModelEvent($this)); - $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(BlockVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - // event behavior - EventDispatcherProxy::trigger('model.save.pre', new ModelEvent($this)); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // event behavior - EventDispatcherProxy::trigger('model.insert.pre', new ModelEvent($this)); - } else { - $ret = $ret && $this->preUpdate($con); - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'model.update.pre'), new ModelEvent($this)); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - // event behavior - EventDispatcherProxy::trigger('model.insert.post', new ModelEvent($this)); - } else { - $this->postUpdate($con); - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'model.update.post'), new ModelEvent($this)); - } - $this->postSave($con); - // event behavior - EventDispatcherProxy::trigger('model.save.post', new ModelEvent($this)); - BlockVersionPeer::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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aBlock !== null) { - if ($this->aBlock->isModified() || $this->aBlock->isNew()) { - $affectedRows += $this->aBlock->save($con); - } - $this->setBlock($this->aBlock); - } - - 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(BlockVersionPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`id`'; - } - if ($this->isColumnModified(BlockVersionPeer::NAME)) { - $modifiedColumns[':p' . $index++] = '`name`'; - } - if ($this->isColumnModified(BlockVersionPeer::VALUE)) { - $modifiedColumns[':p' . $index++] = '`value`'; - } - if ($this->isColumnModified(BlockVersionPeer::CLASS_KEY)) { - $modifiedColumns[':p' . $index++] = '`class_key`'; - } - if ($this->isColumnModified(BlockVersionPeer::TEMPLATE)) { - $modifiedColumns[':p' . $index++] = '`template`'; - } - if ($this->isColumnModified(BlockVersionPeer::MODEL_ID)) { - $modifiedColumns[':p' . $index++] = '`model_id`'; - } - if ($this->isColumnModified(BlockVersionPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`created_at`'; - } - if ($this->isColumnModified(BlockVersionPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`updated_at`'; - } - if ($this->isColumnModified(BlockVersionPeer::VERSION)) { - $modifiedColumns[':p' . $index++] = '`version`'; - } - if ($this->isColumnModified(BlockVersionPeer::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`version_created_at`'; - } - if ($this->isColumnModified(BlockVersionPeer::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = '`version_created_by`'; - } - if ($this->isColumnModified(BlockVersionPeer::MODEL_ID_VERSION)) { - $modifiedColumns[':p' . $index++] = '`model_id_version`'; - } - - $sql = sprintf( - 'INSERT INTO `nws_block_version` (%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 '`name`': - $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); - break; - case '`value`': - $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR); - break; - case '`class_key`': - $stmt->bindValue($identifier, $this->class_key, PDO::PARAM_STR); - break; - case '`template`': - $stmt->bindValue($identifier, $this->template, PDO::PARAM_STR); - break; - case '`model_id`': - $stmt->bindValue($identifier, $this->model_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; - case '`version`': - $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); - break; - case '`version_created_at`': - $stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR); - break; - case '`version_created_by`': - $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); - break; - case '`model_id_version`': - $stmt->bindValue($identifier, $this->model_id_version, PDO::PARAM_INT); - 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; - } - - $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 aggregated 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 objects 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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aBlock !== null) { - if (!$this->aBlock->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aBlock->getValidationFailures()); - } - } - - - if (($retval = BlockVersionPeer::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 = BlockVersionPeer::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->getName(); - break; - case 2: - return $this->getValue(); - break; - case 3: - return $this->getClassKey(); - break; - case 4: - return $this->getTemplate(); - break; - case 5: - return $this->getModelId(); - break; - case 6: - return $this->getCreatedAt(); - break; - case 7: - return $this->getUpdatedAt(); - break; - case 8: - return $this->getVersion(); - break; - case 9: - return $this->getVersionCreatedAt(); - break; - case 10: - return $this->getVersionCreatedBy(); - break; - case 11: - return $this->getModelIdVersion(); - 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['BlockVersion'][serialize($this->getPrimaryKey())])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['BlockVersion'][serialize($this->getPrimaryKey())] = true; - $keys = BlockVersionPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getName(), - $keys[2] => $this->getValue(), - $keys[3] => $this->getClassKey(), - $keys[4] => $this->getTemplate(), - $keys[5] => $this->getModelId(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), - $keys[8] => $this->getVersion(), - $keys[9] => $this->getVersionCreatedAt(), - $keys[10] => $this->getVersionCreatedBy(), - $keys[11] => $this->getModelIdVersion(), - ); - $virtualColumns = $this->virtualColumns; - foreach ($virtualColumns as $key => $virtualColumn) { - $result[$key] = $virtualColumn; - } - - if ($includeForeignObjects) { - if (null !== $this->aBlock) { - $result['Block'] = $this->aBlock->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 = BlockVersionPeer::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->setName($value); - break; - case 2: - $this->setValue($value); - break; - case 3: - $this->setClassKey($value); - break; - case 4: - $this->setTemplate($value); - break; - case 5: - $this->setModelId($value); - break; - case 6: - $this->setCreatedAt($value); - break; - case 7: - $this->setUpdatedAt($value); - break; - case 8: - $this->setVersion($value); - break; - case 9: - $this->setVersionCreatedAt($value); - break; - case 10: - $this->setVersionCreatedBy($value); - break; - case 11: - $this->setModelIdVersion($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 = BlockVersionPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setValue($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setClassKey($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setTemplate($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setModelId($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]]); - if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setModelIdVersion($arr[$keys[11]]); - } - - /** - * 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(BlockVersionPeer::DATABASE_NAME); - - if ($this->isColumnModified(BlockVersionPeer::ID)) $criteria->add(BlockVersionPeer::ID, $this->id); - if ($this->isColumnModified(BlockVersionPeer::NAME)) $criteria->add(BlockVersionPeer::NAME, $this->name); - if ($this->isColumnModified(BlockVersionPeer::VALUE)) $criteria->add(BlockVersionPeer::VALUE, $this->value); - if ($this->isColumnModified(BlockVersionPeer::CLASS_KEY)) $criteria->add(BlockVersionPeer::CLASS_KEY, $this->class_key); - if ($this->isColumnModified(BlockVersionPeer::TEMPLATE)) $criteria->add(BlockVersionPeer::TEMPLATE, $this->template); - if ($this->isColumnModified(BlockVersionPeer::MODEL_ID)) $criteria->add(BlockVersionPeer::MODEL_ID, $this->model_id); - if ($this->isColumnModified(BlockVersionPeer::CREATED_AT)) $criteria->add(BlockVersionPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(BlockVersionPeer::UPDATED_AT)) $criteria->add(BlockVersionPeer::UPDATED_AT, $this->updated_at); - if ($this->isColumnModified(BlockVersionPeer::VERSION)) $criteria->add(BlockVersionPeer::VERSION, $this->version); - if ($this->isColumnModified(BlockVersionPeer::VERSION_CREATED_AT)) $criteria->add(BlockVersionPeer::VERSION_CREATED_AT, $this->version_created_at); - if ($this->isColumnModified(BlockVersionPeer::VERSION_CREATED_BY)) $criteria->add(BlockVersionPeer::VERSION_CREATED_BY, $this->version_created_by); - if ($this->isColumnModified(BlockVersionPeer::MODEL_ID_VERSION)) $criteria->add(BlockVersionPeer::MODEL_ID_VERSION, $this->model_id_version); - - 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(BlockVersionPeer::DATABASE_NAME); - $criteria->add(BlockVersionPeer::ID, $this->id); - $criteria->add(BlockVersionPeer::VERSION, $this->version); - - return $criteria; - } - - /** - * Returns the composite primary key for this object. - * The array elements will be in same order as specified in XML. - * @return array - */ - public function getPrimaryKey() - { - $pks = array(); - $pks[0] = $this->getId(); - $pks[1] = $this->getVersion(); - - return $pks; - } - - /** - * Set the [composite] primary key. - * - * @param array $keys The elements of the composite key (order must match the order in XML file). - * @return void - */ - public function setPrimaryKey($keys) - { - $this->setId($keys[0]); - $this->setVersion($keys[1]); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return (null === $this->getId()) && (null === $this->getVersion()); - } - - /** - * 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 BlockVersion (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->setId($this->getId()); - $copyObj->setName($this->getName()); - $copyObj->setValue($this->getValue()); - $copyObj->setClassKey($this->getClassKey()); - $copyObj->setTemplate($this->getTemplate()); - $copyObj->setModelId($this->getModelId()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - $copyObj->setVersion($this->getVersion()); - $copyObj->setVersionCreatedAt($this->getVersionCreatedAt()); - $copyObj->setVersionCreatedBy($this->getVersionCreatedBy()); - $copyObj->setModelIdVersion($this->getModelIdVersion()); - - 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); - } - } - - /** - * 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 BlockVersion 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 BlockVersionPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new BlockVersionPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Block object. - * - * @param Block $v - * @return BlockVersion The current object (for fluent API support) - * @throws PropelException - */ - public function setBlock(Block $v = null) - { - if ($v === null) { - $this->setId(NULL); - } else { - $this->setId($v->getId()); - } - - $this->aBlock = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Block object, it will not be re-added. - if ($v !== null) { - $v->addBlockVersion($this); - } - - - return $this; - } - - - /** - * Get the associated Block object - * - * @param PropelPDO $con Optional Connection object. - * @param $doQuery Executes a query to get the object if required - * @return Block The associated Block object. - * @throws PropelException - */ - public function getBlock(PropelPDO $con = null, $doQuery = true) - { - if ($this->aBlock === null && ($this->id !== null) && $doQuery) { - $this->aBlock = BlockQuery::create()->findPk($this->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->aBlock->addBlockVersions($this); - */ - } - - return $this->aBlock; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->name = null; - $this->value = null; - $this->class_key = null; - $this->template = null; - $this->model_id = null; - $this->created_at = null; - $this->updated_at = null; - $this->version = null; - $this->version_created_at = null; - $this->version_created_by = null; - $this->model_id_version = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->alreadyInClearAllReferencesDeep = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $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-volume/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep && !$this->alreadyInClearAllReferencesDeep) { - $this->alreadyInClearAllReferencesDeep = true; - if ($this->aBlock instanceof Persistent) { - $this->aBlock->clearAllReferences($deep); - } - - $this->alreadyInClearAllReferencesDeep = false; - } // if ($deep) - - $this->aBlock = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(BlockVersionPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // event behavior - public function preCommit(\PropelPDO $con = null){} - public function preCommitSave(\PropelPDO $con = null){} - public function preCommitDelete(\PropelPDO $con = null){} - public function preCommitUpdate(\PropelPDO $con = null){} - public function preCommitInsert(\PropelPDO $con = null){} - public function preRollback(\PropelPDO $con = null){} - public function preRollbackSave(\PropelPDO $con = null){} - public function preRollbackDelete(\PropelPDO $con = null){} - public function preRollbackUpdate(\PropelPDO $con = null){} - public function preRollbackInsert(\PropelPDO $con = null){} - -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockVersionPeer.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockVersionPeer.php deleted file mode 100644 index 1e72cf3..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockVersionPeer.php +++ /dev/null @@ -1,1065 +0,0 @@ - array ('Id', 'Name', 'Value', 'ClassKey', 'Template', 'ModelId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', 'ModelIdVersion', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'value', 'classKey', 'template', 'modelId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', 'modelIdVersion', ), - BasePeer::TYPE_COLNAME => array (BlockVersionPeer::ID, BlockVersionPeer::NAME, BlockVersionPeer::VALUE, BlockVersionPeer::CLASS_KEY, BlockVersionPeer::TEMPLATE, BlockVersionPeer::MODEL_ID, BlockVersionPeer::CREATED_AT, BlockVersionPeer::UPDATED_AT, BlockVersionPeer::VERSION, BlockVersionPeer::VERSION_CREATED_AT, BlockVersionPeer::VERSION_CREATED_BY, BlockVersionPeer::MODEL_ID_VERSION, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'VALUE', 'CLASS_KEY', 'TEMPLATE', 'MODEL_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', 'MODEL_ID_VERSION', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'value', 'class_key', 'template', 'model_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', 'model_id_version', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. BlockVersionPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'Value' => 2, 'ClassKey' => 3, 'Template' => 4, 'ModelId' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, 'Version' => 8, 'VersionCreatedAt' => 9, 'VersionCreatedBy' => 10, 'ModelIdVersion' => 11, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'value' => 2, 'classKey' => 3, 'template' => 4, 'modelId' => 5, 'createdAt' => 6, 'updatedAt' => 7, 'version' => 8, 'versionCreatedAt' => 9, 'versionCreatedBy' => 10, 'modelIdVersion' => 11, ), - BasePeer::TYPE_COLNAME => array (BlockVersionPeer::ID => 0, BlockVersionPeer::NAME => 1, BlockVersionPeer::VALUE => 2, BlockVersionPeer::CLASS_KEY => 3, BlockVersionPeer::TEMPLATE => 4, BlockVersionPeer::MODEL_ID => 5, BlockVersionPeer::CREATED_AT => 6, BlockVersionPeer::UPDATED_AT => 7, BlockVersionPeer::VERSION => 8, BlockVersionPeer::VERSION_CREATED_AT => 9, BlockVersionPeer::VERSION_CREATED_BY => 10, BlockVersionPeer::MODEL_ID_VERSION => 11, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'VALUE' => 2, 'CLASS_KEY' => 3, 'TEMPLATE' => 4, 'MODEL_ID' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, 'VERSION' => 8, 'VERSION_CREATED_AT' => 9, 'VERSION_CREATED_BY' => 10, 'MODEL_ID_VERSION' => 11, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'value' => 2, 'class_key' => 3, 'template' => 4, 'model_id' => 5, 'created_at' => 6, 'updated_at' => 7, 'version' => 8, 'version_created_at' => 9, 'version_created_by' => 10, 'model_id_version' => 11, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) - ); - - /** - * 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 = BlockVersionPeer::getFieldNames($toType); - $key = isset(BlockVersionPeer::$fieldKeys[$fromType][$name]) ? BlockVersionPeer::$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(BlockVersionPeer::$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, BlockVersionPeer::$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 BlockVersionPeer::$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. BlockVersionPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(BlockVersionPeer::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(BlockVersionPeer::ID); - $criteria->addSelectColumn(BlockVersionPeer::NAME); - $criteria->addSelectColumn(BlockVersionPeer::VALUE); - $criteria->addSelectColumn(BlockVersionPeer::CLASS_KEY); - $criteria->addSelectColumn(BlockVersionPeer::TEMPLATE); - $criteria->addSelectColumn(BlockVersionPeer::MODEL_ID); - $criteria->addSelectColumn(BlockVersionPeer::CREATED_AT); - $criteria->addSelectColumn(BlockVersionPeer::UPDATED_AT); - $criteria->addSelectColumn(BlockVersionPeer::VERSION); - $criteria->addSelectColumn(BlockVersionPeer::VERSION_CREATED_AT); - $criteria->addSelectColumn(BlockVersionPeer::VERSION_CREATED_BY); - $criteria->addSelectColumn(BlockVersionPeer::MODEL_ID_VERSION); - } else { - $criteria->addSelectColumn($alias . '.id'); - $criteria->addSelectColumn($alias . '.name'); - $criteria->addSelectColumn($alias . '.value'); - $criteria->addSelectColumn($alias . '.class_key'); - $criteria->addSelectColumn($alias . '.template'); - $criteria->addSelectColumn($alias . '.model_id'); - $criteria->addSelectColumn($alias . '.created_at'); - $criteria->addSelectColumn($alias . '.updated_at'); - $criteria->addSelectColumn($alias . '.version'); - $criteria->addSelectColumn($alias . '.version_created_at'); - $criteria->addSelectColumn($alias . '.version_created_by'); - $criteria->addSelectColumn($alias . '.model_id_version'); - } - } - - /** - * 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(BlockVersionPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - BlockVersionPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(BlockVersionPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(BlockVersionPeer::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 BlockVersion - * @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 = BlockVersionPeer::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 BlockVersionPeer::populateObjects(BlockVersionPeer::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 directly (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(BlockVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - BlockVersionPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(BlockVersionPeer::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 BlockVersion $obj A BlockVersion 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 = serialize(array((string) $obj->getId(), (string) $obj->getVersion())); - } // if key === null - BlockVersionPeer::$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 BlockVersion 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 BlockVersion) { - $key = serialize(array((string) $value->getId(), (string) $value->getVersion())); - } elseif (is_array($value) && count($value) === 2) { - // assume we've been passed a primary key - $key = serialize(array((string) $value[0], (string) $value[1])); - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or BlockVersion object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(BlockVersionPeer::$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 BlockVersion 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(BlockVersionPeer::$instances[$key])) { - return BlockVersionPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool($and_clear_all_references = false) - { - if ($and_clear_all_references) { - foreach (BlockVersionPeer::$instances as $instance) { - $instance->clearAllReferences(true); - } - } - BlockVersionPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to nws_block_version - * 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 && $row[$startcol + 8] === null) { - return null; - } - - return serialize(array((string) $row[$startcol], (string) $row[$startcol + 8])); - } - - /** - * 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 array((int) $row[$startcol], (int) $row[$startcol + 8]); - } - - /** - * 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(); - - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = BlockVersionPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = BlockVersionPeer::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 { - // class must be set each time from the record row - $cls = BlockVersionPeer::getOMClass($row, 0); - $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - BlockVersionPeer::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 (BlockVersion object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = BlockVersionPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = BlockVersionPeer::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 + BlockVersionPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = BlockVersionPeer::getOMClass($row, $startcol); - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - BlockVersionPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Block 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 doCountJoinBlock(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(BlockVersionPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - BlockVersionPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(BlockVersionPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(BlockVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(BlockVersionPeer::ID, BlockPeer::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 BlockVersion objects pre-filled with their Block 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 BlockVersion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinBlock(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(BlockVersionPeer::DATABASE_NAME); - } - - BlockVersionPeer::addSelectColumns($criteria); - $startcol = BlockVersionPeer::NUM_HYDRATE_COLUMNS; - BlockPeer::addSelectColumns($criteria); - - $criteria->addJoin(BlockVersionPeer::ID, BlockPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = BlockVersionPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = BlockVersionPeer::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 { - - $omClass = BlockVersionPeer::getOMClass($row, 0); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj1 = new $cls(); - $obj1->hydrate($row); - BlockVersionPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = BlockPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = BlockPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $omClass = BlockPeer::getOMClass($row, $startcol); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - BlockPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (BlockVersion) to $obj2 (Block) - $obj2->addBlockVersion($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(BlockVersionPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - BlockVersionPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(BlockVersionPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(BlockVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(BlockVersionPeer::ID, BlockPeer::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 BlockVersion 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 BlockVersion 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(BlockVersionPeer::DATABASE_NAME); - } - - BlockVersionPeer::addSelectColumns($criteria); - $startcol2 = BlockVersionPeer::NUM_HYDRATE_COLUMNS; - - BlockPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + BlockPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(BlockVersionPeer::ID, BlockPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = BlockVersionPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = BlockVersionPeer::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 { - $omClass = BlockVersionPeer::getOMClass($row, 0); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj1 = new $cls(); - $obj1->hydrate($row); - BlockVersionPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Block rows - - $key2 = BlockPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = BlockPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $omClass = BlockPeer::getOMClass($row, $startcol2); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - BlockPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (BlockVersion) to the collection in $obj2 (Block) - $obj2->addBlockVersion($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(BlockVersionPeer::DATABASE_NAME)->getTable(BlockVersionPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseBlockVersionPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseBlockVersionPeer::TABLE_NAME)) { - $dbMap->addTableObject(new \Trinity\Bundle\NewsletterBundle\Model\map\BlockVersionTableMap()); - } - } - - /** - * The returned Class will contain objects of the default type or - * objects that inherit from the default. - * - * @param array $row PropelPDO result row. - * @param int $colnum Column to examine for OM class information (first is 0). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getOMClass($row = 0, $colnum = 0) - { - try { - - $omClass = $row[$colnum + 3]; - $omClass = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - } catch (Exception $e) { - throw new PropelException('Unable to get OM class.', $e); - } - - - $event = new DetectOMClassEvent($omClass); - EventDispatcherProxy::trigger('om.detect', $event); - if($event->isDetected()){ - return $event->getDetectedClass(); - } - - return $omClass; - } - - /** - * Performs an INSERT on the database, given a BlockVersion or Criteria object. - * - * @param mixed $values Criteria or BlockVersion 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(BlockVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from BlockVersion object - } - - - // Set the correct dbName - $criteria->setDbName(BlockVersionPeer::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 (Exception $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a BlockVersion or Criteria object. - * - * @param mixed $values Criteria or BlockVersion 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(BlockVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(BlockVersionPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(BlockVersionPeer::ID); - $value = $criteria->remove(BlockVersionPeer::ID); - if ($value) { - $selectCriteria->add(BlockVersionPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(BlockVersionPeer::TABLE_NAME); - } - - $comparison = $criteria->getComparison(BlockVersionPeer::VERSION); - $value = $criteria->remove(BlockVersionPeer::VERSION); - if ($value) { - $selectCriteria->add(BlockVersionPeer::VERSION, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(BlockVersionPeer::TABLE_NAME); - } - - } else { // $values is BlockVersion object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(BlockVersionPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the nws_block_version 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(BlockVersionPeer::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(BlockVersionPeer::TABLE_NAME, $con, BlockVersionPeer::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). - BlockVersionPeer::clearInstancePool(); - BlockVersionPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a BlockVersion or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or BlockVersion 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(BlockVersionPeer::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. - BlockVersionPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof BlockVersion) { // it's a model object - // invalidate the cache for this single object - BlockVersionPeer::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(BlockVersionPeer::DATABASE_NAME); - // primary key is composite; we therefore, expect - // the primary key passed to be an array of pkey values - if (count($values) == count($values, COUNT_RECURSIVE)) { - // array is not multi-dimensional - $values = array($values); - } - foreach ($values as $value) { - $criterion = $criteria->getNewCriterion(BlockVersionPeer::ID, $value[0]); - $criterion->addAnd($criteria->getNewCriterion(BlockVersionPeer::VERSION, $value[1])); - $criteria->addOr($criterion); - // we can invalidate the cache for this single PK - BlockVersionPeer::removeInstanceFromPool($value); - } - } - - // Set the correct dbName - $criteria->setDbName(BlockVersionPeer::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); - BlockVersionPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given BlockVersion 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 BlockVersion $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(BlockVersionPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(BlockVersionPeer::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(BlockVersionPeer::DATABASE_NAME, BlockVersionPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve object using using composite pkey values. - * @param int $id - * @param int $version - * @param PropelPDO $con - * @return BlockVersion - */ - public static function retrieveByPK($id, $version, PropelPDO $con = null) { - $_instancePoolKey = serialize(array((string) $id, (string) $version)); - if (null !== ($obj = BlockVersionPeer::getInstanceFromPool($_instancePoolKey))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(BlockVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $criteria = new Criteria(BlockVersionPeer::DATABASE_NAME); - $criteria->add(BlockVersionPeer::ID, $id); - $criteria->add(BlockVersionPeer::VERSION, $version); - $v = BlockVersionPeer::doSelect($criteria, $con); - - return !empty($v) ? $v[0] : null; - } -} // BaseBlockVersionPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseBlockVersionPeer::buildTableMap(); - -EventDispatcherProxy::trigger(array('construct','peer.construct'), new PeerEvent('Trinity\Bundle\NewsletterBundle\Model\om\BaseBlockVersionPeer')); diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockVersionQuery.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockVersionQuery.php deleted file mode 100644 index da8e8aa..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseBlockVersionQuery.php +++ /dev/null @@ -1,896 +0,0 @@ -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(array(12, 34), $con); - * - * - * @param array $key Primary key to use for the query - A Primary key composition: [$id, $version] - * @param PropelPDO $con an optional connection object - * - * @return BlockVersion|BlockVersion[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = BlockVersionPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) { - // the object is already in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(BlockVersionPeer::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 BlockVersion A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `id`, `name`, `value`, `class_key`, `template`, `model_id`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by`, `model_id_version` FROM `nws_block_version` WHERE `id` = :p0 AND `version` = :p1'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); - $stmt->bindValue(':p1', $key[1], 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)) { - $cls = BlockVersionPeer::getOMClass($row, 0); - $obj = new $cls(); - $obj->hydrate($row); - BlockVersionPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); - } - $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 BlockVersion|BlockVersion[]|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(array(12, 56), array(832, 123), array(123, 456)), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|BlockVersion[]|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 BlockVersionQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - $this->addUsingAlias(BlockVersionPeer::ID, $key[0], Criteria::EQUAL); - $this->addUsingAlias(BlockVersionPeer::VERSION, $key[1], Criteria::EQUAL); - - return $this; - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return BlockVersionQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - if (empty($keys)) { - return $this->add(null, '1<>1', Criteria::CUSTOM); - } - foreach ($keys as $key) { - $cton0 = $this->getNewCriterion(BlockVersionPeer::ID, $key[0], Criteria::EQUAL); - $cton1 = $this->getNewCriterion(BlockVersionPeer::VERSION, $key[1], Criteria::EQUAL); - $cton0->addAnd($cton1); - $this->addOr($cton0); - } - - return $this; - } - - /** - * 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 - * $query->filterById(array('max' => 12)); // WHERE id <= 12 - * - * - * @see filterByBlock() - * - * @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 BlockVersionQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id)) { - $useMinMax = false; - if (isset($id['min'])) { - $this->addUsingAlias(BlockVersionPeer::ID, $id['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($id['max'])) { - $this->addUsingAlias(BlockVersionPeer::ID, $id['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockVersionPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the name column - * - * Example usage: - * - * $query->filterByName('fooValue'); // WHERE name = 'fooValue' - * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' - * - * - * @param string $name 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 BlockVersionQuery The current query, for fluid interface - */ - public function filterByName($name = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($name)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $name)) { - $name = str_replace('*', '%', $name); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(BlockVersionPeer::NAME, $name, $comparison); - } - - /** - * Filter the query on the value column - * - * Example usage: - * - * $query->filterByValue('fooValue'); // WHERE value = 'fooValue' - * $query->filterByValue('%fooValue%'); // WHERE value LIKE '%fooValue%' - * - * - * @param string $value 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 BlockVersionQuery The current query, for fluid interface - */ - public function filterByValue($value = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($value)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $value)) { - $value = str_replace('*', '%', $value); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(BlockVersionPeer::VALUE, $value, $comparison); - } - - /** - * Filter the query on the class_key column - * - * Example usage: - * - * $query->filterByClassKey('fooValue'); // WHERE class_key = 'fooValue' - * $query->filterByClassKey('%fooValue%'); // WHERE class_key LIKE '%fooValue%' - * - * - * @param string $classKey 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 BlockVersionQuery The current query, for fluid interface - */ - public function filterByClassKey($classKey = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($classKey)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $classKey)) { - $classKey = str_replace('*', '%', $classKey); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(BlockVersionPeer::CLASS_KEY, $classKey, $comparison); - } - - /** - * Filter the query on the template column - * - * Example usage: - * - * $query->filterByTemplate('fooValue'); // WHERE template = 'fooValue' - * $query->filterByTemplate('%fooValue%'); // WHERE template LIKE '%fooValue%' - * - * - * @param string $template 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 BlockVersionQuery The current query, for fluid interface - */ - public function filterByTemplate($template = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($template)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $template)) { - $template = str_replace('*', '%', $template); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(BlockVersionPeer::TEMPLATE, $template, $comparison); - } - - /** - * Filter the query on the model_id column - * - * Example usage: - * - * $query->filterByModelId(1234); // WHERE model_id = 1234 - * $query->filterByModelId(array(12, 34)); // WHERE model_id IN (12, 34) - * $query->filterByModelId(array('min' => 12)); // WHERE model_id >= 12 - * $query->filterByModelId(array('max' => 12)); // WHERE model_id <= 12 - * - * - * @param mixed $modelId 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 BlockVersionQuery The current query, for fluid interface - */ - public function filterByModelId($modelId = null, $comparison = null) - { - if (is_array($modelId)) { - $useMinMax = false; - if (isset($modelId['min'])) { - $this->addUsingAlias(BlockVersionPeer::MODEL_ID, $modelId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($modelId['max'])) { - $this->addUsingAlias(BlockVersionPeer::MODEL_ID, $modelId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockVersionPeer::MODEL_ID, $modelId, $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 BlockVersionQuery 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(BlockVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(BlockVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockVersionPeer::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 BlockVersionQuery 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(BlockVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(BlockVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockVersionPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query on the version column - * - * Example usage: - * - * $query->filterByVersion(1234); // WHERE version = 1234 - * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34) - * $query->filterByVersion(array('min' => 12)); // WHERE version >= 12 - * $query->filterByVersion(array('max' => 12)); // WHERE version <= 12 - * - * - * @param mixed $version 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 BlockVersionQuery The current query, for fluid interface - */ - public function filterByVersion($version = null, $comparison = null) - { - if (is_array($version)) { - $useMinMax = false; - if (isset($version['min'])) { - $this->addUsingAlias(BlockVersionPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($version['max'])) { - $this->addUsingAlias(BlockVersionPeer::VERSION, $version['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockVersionPeer::VERSION, $version, $comparison); - } - - /** - * Filter the query on the version_created_at column - * - * Example usage: - * - * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14' - * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14' - * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at < '2011-03-13' - * - * - * @param mixed $versionCreatedAt 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 BlockVersionQuery The current query, for fluid interface - */ - public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null) - { - if (is_array($versionCreatedAt)) { - $useMinMax = false; - if (isset($versionCreatedAt['min'])) { - $this->addUsingAlias(BlockVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($versionCreatedAt['max'])) { - $this->addUsingAlias(BlockVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison); - } - - /** - * Filter the query on the version_created_by column - * - * Example usage: - * - * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue' - * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%' - * - * - * @param string $versionCreatedBy 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 BlockVersionQuery The current query, for fluid interface - */ - public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($versionCreatedBy)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) { - $versionCreatedBy = str_replace('*', '%', $versionCreatedBy); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(BlockVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison); - } - - /** - * Filter the query on the model_id_version column - * - * Example usage: - * - * $query->filterByModelIdVersion(1234); // WHERE model_id_version = 1234 - * $query->filterByModelIdVersion(array(12, 34)); // WHERE model_id_version IN (12, 34) - * $query->filterByModelIdVersion(array('min' => 12)); // WHERE model_id_version >= 12 - * $query->filterByModelIdVersion(array('max' => 12)); // WHERE model_id_version <= 12 - * - * - * @param mixed $modelIdVersion 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 BlockVersionQuery The current query, for fluid interface - */ - public function filterByModelIdVersion($modelIdVersion = null, $comparison = null) - { - if (is_array($modelIdVersion)) { - $useMinMax = false; - if (isset($modelIdVersion['min'])) { - $this->addUsingAlias(BlockVersionPeer::MODEL_ID_VERSION, $modelIdVersion['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($modelIdVersion['max'])) { - $this->addUsingAlias(BlockVersionPeer::MODEL_ID_VERSION, $modelIdVersion['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(BlockVersionPeer::MODEL_ID_VERSION, $modelIdVersion, $comparison); - } - - /** - * Filter the query by a related Block object - * - * @param Block|PropelObjectCollection $block The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return BlockVersionQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByBlock($block, $comparison = null) - { - if ($block instanceof Block) { - return $this - ->addUsingAlias(BlockVersionPeer::ID, $block->getId(), $comparison); - } elseif ($block instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(BlockVersionPeer::ID, $block->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByBlock() only accepts arguments of type Block or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Block relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return BlockVersionQuery The current query, for fluid interface - */ - public function joinBlock($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Block'); - - // 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, 'Block'); - } - - return $this; - } - - /** - * Use the Block relation Block 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 \Trinity\Bundle\NewsletterBundle\Model\BlockQuery A secondary query class using the current class as primary query - */ - public function useBlockQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinBlock($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Block', '\Trinity\Bundle\NewsletterBundle\Model\BlockQuery'); - } - - /** - * Exclude object from result - * - * @param BlockVersion $blockVersion Object to remove from the list of results - * - * @return BlockVersionQuery The current query, for fluid interface - */ - public function prune($blockVersion = null) - { - if ($blockVersion) { - $this->addCond('pruneCond0', $this->getAliasedColName(BlockVersionPeer::ID), $blockVersion->getId(), Criteria::NOT_EQUAL); - $this->addCond('pruneCond1', $this->getAliasedColName(BlockVersionPeer::VERSION), $blockVersion->getVersion(), Criteria::NOT_EQUAL); - $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); - } - - return $this; - } - - /** - * Code to execute before every SELECT statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreSelect(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger('query.select.pre', new QueryEvent($this)); - - return $this->preSelect($con); - } - - /** - * Code to execute before every DELETE statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreDelete(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','query.delete.pre'), new QueryEvent($this)); - - return $this->preDelete($con); - } - - /** - * Code to execute after every DELETE statement - * - * @param int $affectedRows the number of deleted rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostDelete($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.post','query.delete.post'), new QueryEvent($this)); - - return $this->postDelete($affectedRows, $con); - } - - /** - * Code to execute before every UPDATE statement - * - * @param array $values The associative array of columns and values for the update - * @param PropelPDO $con The connection object used by the query - * @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), otherwise it is a series of save() calls on all the found objects - */ - protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false) - { - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'query.update.pre'), new QueryEvent($this)); - - return $this->preUpdate($values, $con, $forceIndividualSaves); - } - - /** - * Code to execute after every UPDATE statement - * - * @param int $affectedRows the number of updated rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostUpdate($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'query.update.post'), new QueryEvent($this)); - - return $this->postUpdate($affectedRows, $con); - } - - // extend behavior - public function setFormatter($formatter) - { - if (is_string($formatter) && $formatter === \ModelCriteria::FORMAT_ON_DEMAND) { - $formatter = '\Glorpen\Propel\PropelBundle\Formatter\PropelOnDemandFormatter'; - } - - return parent::setFormatter($formatter); - } -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModel.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModel.php deleted file mode 100644 index 4fc46e7..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModel.php +++ /dev/null @@ -1,2658 +0,0 @@ -version = 0; - } - - /** - * Initializes internal state of BaseModel object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - EventDispatcherProxy::trigger(array('construct','model.construct'), new ModelEvent($this)); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getId() - { - - return $this->id; - } - - /** - * Get the [name] column value. - * - * @return string - */ - public function getName() - { - - return $this->name; - } - - /** - * Get the [template] column value. - * - * @return string - */ - public function getTemplate() - { - - return $this->template; - } - - /** - * Get the [class_key] column value. - * - * @return string - */ - public function getClassKey() - { - - return $this->class_key; - } - - /** - * 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 = null) - { - 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; - } - - 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; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - 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 = null) - { - 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; - } - - 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; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * Get the [version] column value. - * - * @return int - */ - public function getVersion() - { - - return $this->version; - } - - /** - * Get the [optionally formatted] temporal [version_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 getVersionCreatedAt($format = null) - { - if ($this->version_created_at === null) { - return null; - } - - if ($this->version_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; - } - - try { - $dt = new DateTime($this->version_created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * Get the [version_created_by] column value. - * - * @return string - */ - public function getVersionCreatedBy() - { - - return $this->version_created_by; - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return Model The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = ModelPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [name] column. - * - * @param string $v new value - * @return Model The current object (for fluent API support) - */ - public function setName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->name !== $v) { - $this->name = $v; - $this->modifiedColumns[] = ModelPeer::NAME; - } - - - return $this; - } // setName() - - /** - * Set the value of [template] column. - * - * @param string $v new value - * @return Model The current object (for fluent API support) - */ - public function setTemplate($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->template !== $v) { - $this->template = $v; - $this->modifiedColumns[] = ModelPeer::TEMPLATE; - } - - - return $this; - } // setTemplate() - - /** - * Set the value of [class_key] column. - * - * @param string $v new value - * @return Model The current object (for fluent API support) - */ - public function setClassKey($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->class_key !== $v) { - $this->class_key = $v; - $this->modifiedColumns[] = ModelPeer::CLASS_KEY; - } - - - return $this; - } // setClassKey() - - /** - * 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 Model 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[] = ModelPeer::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 Model 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[] = ModelPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Set the value of [version] column. - * - * @param int $v new value - * @return Model The current object (for fluent API support) - */ - public function setVersion($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->version !== $v) { - $this->version = $v; - $this->modifiedColumns[] = ModelPeer::VERSION; - } - - - return $this; - } // setVersion() - - /** - * Sets the value of [version_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 Model The current object (for fluent API support) - */ - public function setVersionCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->version_created_at !== null || $dt !== null) { - $currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_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->version_created_at = $newDateAsString; - $this->modifiedColumns[] = ModelPeer::VERSION_CREATED_AT; - } - } // if either are not null - - - return $this; - } // setVersionCreatedAt() - - /** - * Set the value of [version_created_by] column. - * - * @param string $v new value - * @return Model The current object (for fluent API support) - */ - public function setVersionCreatedBy($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->version_created_by !== $v) { - $this->version_created_by = $v; - $this->modifiedColumns[] = ModelPeer::VERSION_CREATED_BY; - } - - - return $this; - } // setVersionCreatedBy() - - /** - * 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() - { - if ($this->version !== 0) { - return false; - } - - // 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 resultset 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->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->template = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->class_key = ($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->version = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; - $this->version_created_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->version_created_by = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - $this->postHydrate($row, $startcol, $rehydrate); - - return $startcol + 9; // 9 = ModelPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating Model 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() - { - - } // 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(ModelPeer::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 = ModelPeer::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->collNewsletters = null; - - $this->collBlocks = null; - - $this->collModelVersions = 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(ModelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = ModelQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','model.delete.pre'), new ModelEvent($this)); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - // versionable behavior - // emulate delete cascade - ModelVersionQuery::create() - ->filterByModel($this) - ->delete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.post', 'model.delete.post'), new ModelEvent($this)); - $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(ModelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - // versionable behavior - if ($this->isVersioningNecessary()) { - $this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1); - if (!$this->isColumnModified(ModelPeer::VERSION_CREATED_AT)) { - $this->setVersionCreatedAt(time()); - } - $createVersion = true; // for postSave hook - } - // event behavior - EventDispatcherProxy::trigger('model.save.pre', new ModelEvent($this)); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(ModelPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(ModelPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - // event behavior - EventDispatcherProxy::trigger('model.insert.pre', new ModelEvent($this)); - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ModelPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'model.update.pre'), new ModelEvent($this)); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - // event behavior - EventDispatcherProxy::trigger('model.insert.post', new ModelEvent($this)); - } else { - $this->postUpdate($con); - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'model.update.post'), new ModelEvent($this)); - } - $this->postSave($con); - // versionable behavior - if (isset($createVersion)) { - $this->addVersion($con); - } - // event behavior - EventDispatcherProxy::trigger('model.save.post', new ModelEvent($this)); - ModelPeer::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; - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - if ($this->newslettersScheduledForDeletion !== null) { - if (!$this->newslettersScheduledForDeletion->isEmpty()) { - foreach ($this->newslettersScheduledForDeletion as $newsletter) { - // need to save related object because we set the relation to null - $newsletter->save($con); - } - $this->newslettersScheduledForDeletion = null; - } - } - - if ($this->collNewsletters !== null) { - foreach ($this->collNewsletters as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - - if ($this->blocksScheduledForDeletion !== null) { - if (!$this->blocksScheduledForDeletion->isEmpty()) { - BlockQuery::create() - ->filterByPrimaryKeys($this->blocksScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->blocksScheduledForDeletion = null; - } - } - - if ($this->collBlocks !== null) { - foreach ($this->collBlocks as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - - if ($this->modelVersionsScheduledForDeletion !== null) { - if (!$this->modelVersionsScheduledForDeletion->isEmpty()) { - ModelVersionQuery::create() - ->filterByPrimaryKeys($this->modelVersionsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->modelVersionsScheduledForDeletion = null; - } - } - - if ($this->collModelVersions !== null) { - foreach ($this->collModelVersions as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - - $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[] = ModelPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ModelPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ModelPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`id`'; - } - if ($this->isColumnModified(ModelPeer::NAME)) { - $modifiedColumns[':p' . $index++] = '`name`'; - } - if ($this->isColumnModified(ModelPeer::TEMPLATE)) { - $modifiedColumns[':p' . $index++] = '`template`'; - } - if ($this->isColumnModified(ModelPeer::CLASS_KEY)) { - $modifiedColumns[':p' . $index++] = '`class_key`'; - } - if ($this->isColumnModified(ModelPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`created_at`'; - } - if ($this->isColumnModified(ModelPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`updated_at`'; - } - if ($this->isColumnModified(ModelPeer::VERSION)) { - $modifiedColumns[':p' . $index++] = '`version`'; - } - if ($this->isColumnModified(ModelPeer::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`version_created_at`'; - } - if ($this->isColumnModified(ModelPeer::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = '`version_created_by`'; - } - - $sql = sprintf( - 'INSERT INTO `nws_model` (%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 '`name`': - $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); - break; - case '`template`': - $stmt->bindValue($identifier, $this->template, PDO::PARAM_STR); - break; - case '`class_key`': - $stmt->bindValue($identifier, $this->class_key, 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; - case '`version`': - $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); - break; - case '`version_created_at`': - $stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR); - break; - case '`version_created_by`': - $stmt->bindValue($identifier, $this->version_created_by, 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; - } - - $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 aggregated 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 objects otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - if (($retval = ModelPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - if ($this->collNewsletters !== null) { - foreach ($this->collNewsletters as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - if ($this->collBlocks !== null) { - foreach ($this->collBlocks as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - if ($this->collModelVersions !== null) { - foreach ($this->collModelVersions as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - - $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 = ModelPeer::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->getName(); - break; - case 2: - return $this->getTemplate(); - break; - case 3: - return $this->getClassKey(); - break; - case 4: - return $this->getCreatedAt(); - break; - case 5: - return $this->getUpdatedAt(); - break; - case 6: - return $this->getVersion(); - break; - case 7: - return $this->getVersionCreatedAt(); - break; - case 8: - return $this->getVersionCreatedBy(); - 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['Model'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['Model'][$this->getPrimaryKey()] = true; - $keys = ModelPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getName(), - $keys[2] => $this->getTemplate(), - $keys[3] => $this->getClassKey(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), - $keys[6] => $this->getVersion(), - $keys[7] => $this->getVersionCreatedAt(), - $keys[8] => $this->getVersionCreatedBy(), - ); - $virtualColumns = $this->virtualColumns; - foreach ($virtualColumns as $key => $virtualColumn) { - $result[$key] = $virtualColumn; - } - - if ($includeForeignObjects) { - if (null !== $this->collNewsletters) { - $result['Newsletters'] = $this->collNewsletters->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } - if (null !== $this->collBlocks) { - $result['Blocks'] = $this->collBlocks->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } - if (null !== $this->collModelVersions) { - $result['ModelVersions'] = $this->collModelVersions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } - } - - 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 = ModelPeer::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->setName($value); - break; - case 2: - $this->setTemplate($value); - break; - case 3: - $this->setClassKey($value); - break; - case 4: - $this->setCreatedAt($value); - break; - case 5: - $this->setUpdatedAt($value); - break; - case 6: - $this->setVersion($value); - break; - case 7: - $this->setVersionCreatedAt($value); - break; - case 8: - $this->setVersionCreatedBy($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 = ModelPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setTemplate($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setClassKey($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]]); - if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedBy($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(ModelPeer::DATABASE_NAME); - - if ($this->isColumnModified(ModelPeer::ID)) $criteria->add(ModelPeer::ID, $this->id); - if ($this->isColumnModified(ModelPeer::NAME)) $criteria->add(ModelPeer::NAME, $this->name); - if ($this->isColumnModified(ModelPeer::TEMPLATE)) $criteria->add(ModelPeer::TEMPLATE, $this->template); - if ($this->isColumnModified(ModelPeer::CLASS_KEY)) $criteria->add(ModelPeer::CLASS_KEY, $this->class_key); - if ($this->isColumnModified(ModelPeer::CREATED_AT)) $criteria->add(ModelPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ModelPeer::UPDATED_AT)) $criteria->add(ModelPeer::UPDATED_AT, $this->updated_at); - if ($this->isColumnModified(ModelPeer::VERSION)) $criteria->add(ModelPeer::VERSION, $this->version); - if ($this->isColumnModified(ModelPeer::VERSION_CREATED_AT)) $criteria->add(ModelPeer::VERSION_CREATED_AT, $this->version_created_at); - if ($this->isColumnModified(ModelPeer::VERSION_CREATED_BY)) $criteria->add(ModelPeer::VERSION_CREATED_BY, $this->version_created_by); - - 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(ModelPeer::DATABASE_NAME); - $criteria->add(ModelPeer::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 Model (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->setName($this->getName()); - $copyObj->setTemplate($this->getTemplate()); - $copyObj->setClassKey($this->getClassKey()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - $copyObj->setVersion($this->getVersion()); - $copyObj->setVersionCreatedAt($this->getVersionCreatedAt()); - $copyObj->setVersionCreatedBy($this->getVersionCreatedBy()); - - 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; - - foreach ($this->getNewsletters() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addNewsletter($relObj->copy($deepCopy)); - } - } - - foreach ($this->getBlocks() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addBlock($relObj->copy($deepCopy)); - } - } - - foreach ($this->getModelVersions() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addModelVersion($relObj->copy($deepCopy)); - } - } - - //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 Model 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 ModelPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new ModelPeer(); - } - - return self::$peer; - } - - - /** - * Initializes a collection based on the name of a relation. - * Avoids crafting an 'init[$relationName]s' method name - * that wouldn't work when StandardEnglishPluralizer is used. - * - * @param string $relationName The name of the relation to initialize - * @return void - */ - public function initRelation($relationName) - { - if ('Newsletter' == $relationName) { - $this->initNewsletters(); - } - if ('Block' == $relationName) { - $this->initBlocks(); - } - if ('ModelVersion' == $relationName) { - $this->initModelVersions(); - } - } - - /** - * Clears out the collNewsletters collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return Model The current object (for fluent API support) - * @see addNewsletters() - */ - public function clearNewsletters() - { - $this->collNewsletters = null; // important to set this to null since that means it is uninitialized - $this->collNewslettersPartial = null; - - return $this; - } - - /** - * reset is the collNewsletters collection loaded partially - * - * @return void - */ - public function resetPartialNewsletters($v = true) - { - $this->collNewslettersPartial = $v; - } - - /** - * Initializes the collNewsletters collection. - * - * By default this just sets the collNewsletters collection to an empty array (like clearcollNewsletters()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initNewsletters($overrideExisting = true) - { - if (null !== $this->collNewsletters && !$overrideExisting) { - return; - } - $this->collNewsletters = new PropelObjectCollection(); - $this->collNewsletters->setModel('Newsletter'); - } - - /** - * Gets an array of Newsletter objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this Model is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelObjectCollection|Newsletter[] List of Newsletter objects - * @throws PropelException - */ - public function getNewsletters($criteria = null, PropelPDO $con = null) - { - $partial = $this->collNewslettersPartial && !$this->isNew(); - if (null === $this->collNewsletters || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collNewsletters) { - // return empty collection - $this->initNewsletters(); - } else { - $collNewsletters = NewsletterQuery::create(null, $criteria) - ->filterByModel($this) - ->find($con); - if (null !== $criteria) { - if (false !== $this->collNewslettersPartial && count($collNewsletters)) { - $this->initNewsletters(false); - - foreach ($collNewsletters as $obj) { - if (false == $this->collNewsletters->contains($obj)) { - $this->collNewsletters->append($obj); - } - } - - $this->collNewslettersPartial = true; - } - - $collNewsletters->getInternalIterator()->rewind(); - - return $collNewsletters; - } - - if ($partial && $this->collNewsletters) { - foreach ($this->collNewsletters as $obj) { - if ($obj->isNew()) { - $collNewsletters[] = $obj; - } - } - } - - $this->collNewsletters = $collNewsletters; - $this->collNewslettersPartial = false; - } - } - - return $this->collNewsletters; - } - - /** - * Sets a collection of Newsletter objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param PropelCollection $newsletters A Propel collection. - * @param PropelPDO $con Optional connection object - * @return Model The current object (for fluent API support) - */ - public function setNewsletters(PropelCollection $newsletters, PropelPDO $con = null) - { - $newslettersToDelete = $this->getNewsletters(new Criteria(), $con)->diff($newsletters); - - - $this->newslettersScheduledForDeletion = $newslettersToDelete; - - foreach ($newslettersToDelete as $newsletterRemoved) { - $newsletterRemoved->setModel(null); - } - - $this->collNewsletters = null; - foreach ($newsletters as $newsletter) { - $this->addNewsletter($newsletter); - } - - $this->collNewsletters = $newsletters; - $this->collNewslettersPartial = false; - - return $this; - } - - /** - * Returns the number of related Newsletter objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related Newsletter objects. - * @throws PropelException - */ - public function countNewsletters(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - $partial = $this->collNewslettersPartial && !$this->isNew(); - if (null === $this->collNewsletters || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collNewsletters) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getNewsletters()); - } - $query = NewsletterQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByModel($this) - ->count($con); - } - - return count($this->collNewsletters); - } - - /** - * Method called to associate a Newsletter object to this object - * through the Newsletter foreign key attribute. - * - * @param Newsletter $l Newsletter - * @return Model The current object (for fluent API support) - */ - public function addNewsletter(Newsletter $l) - { - if ($this->collNewsletters === null) { - $this->initNewsletters(); - $this->collNewslettersPartial = true; - } - - if (!in_array($l, $this->collNewsletters->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddNewsletter($l); - - if ($this->newslettersScheduledForDeletion and $this->newslettersScheduledForDeletion->contains($l)) { - $this->newslettersScheduledForDeletion->remove($this->newslettersScheduledForDeletion->search($l)); - } - } - - return $this; - } - - /** - * @param Newsletter $newsletter The newsletter object to add. - */ - protected function doAddNewsletter($newsletter) - { - $this->collNewsletters[]= $newsletter; - $newsletter->setModel($this); - } - - /** - * @param Newsletter $newsletter The newsletter object to remove. - * @return Model The current object (for fluent API support) - */ - public function removeNewsletter($newsletter) - { - if ($this->getNewsletters()->contains($newsletter)) { - $this->collNewsletters->remove($this->collNewsletters->search($newsletter)); - if (null === $this->newslettersScheduledForDeletion) { - $this->newslettersScheduledForDeletion = clone $this->collNewsletters; - $this->newslettersScheduledForDeletion->clear(); - } - $this->newslettersScheduledForDeletion[]= $newsletter; - $newsletter->setModel(null); - } - - return $this; - } - - /** - * Clears out the collBlocks collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return Model The current object (for fluent API support) - * @see addBlocks() - */ - public function clearBlocks() - { - $this->collBlocks = null; // important to set this to null since that means it is uninitialized - $this->collBlocksPartial = null; - - return $this; - } - - /** - * reset is the collBlocks collection loaded partially - * - * @return void - */ - public function resetPartialBlocks($v = true) - { - $this->collBlocksPartial = $v; - } - - /** - * Initializes the collBlocks collection. - * - * By default this just sets the collBlocks collection to an empty array (like clearcollBlocks()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initBlocks($overrideExisting = true) - { - if (null !== $this->collBlocks && !$overrideExisting) { - return; - } - $this->collBlocks = new PropelObjectCollection(); - $this->collBlocks->setModel('Block'); - } - - /** - * Gets an array of Block objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this Model is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelObjectCollection|Block[] List of Block objects - * @throws PropelException - */ - public function getBlocks($criteria = null, PropelPDO $con = null) - { - $partial = $this->collBlocksPartial && !$this->isNew(); - if (null === $this->collBlocks || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collBlocks) { - // return empty collection - $this->initBlocks(); - } else { - $collBlocks = BlockQuery::create(null, $criteria) - ->filterByModel($this) - ->find($con); - if (null !== $criteria) { - if (false !== $this->collBlocksPartial && count($collBlocks)) { - $this->initBlocks(false); - - foreach ($collBlocks as $obj) { - if (false == $this->collBlocks->contains($obj)) { - $this->collBlocks->append($obj); - } - } - - $this->collBlocksPartial = true; - } - - $collBlocks->getInternalIterator()->rewind(); - - return $collBlocks; - } - - if ($partial && $this->collBlocks) { - foreach ($this->collBlocks as $obj) { - if ($obj->isNew()) { - $collBlocks[] = $obj; - } - } - } - - $this->collBlocks = $collBlocks; - $this->collBlocksPartial = false; - } - } - - return $this->collBlocks; - } - - /** - * Sets a collection of Block objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param PropelCollection $blocks A Propel collection. - * @param PropelPDO $con Optional connection object - * @return Model The current object (for fluent API support) - */ - public function setBlocks(PropelCollection $blocks, PropelPDO $con = null) - { - $blocksToDelete = $this->getBlocks(new Criteria(), $con)->diff($blocks); - - - $this->blocksScheduledForDeletion = $blocksToDelete; - - foreach ($blocksToDelete as $blockRemoved) { - $blockRemoved->setModel(null); - } - - $this->collBlocks = null; - foreach ($blocks as $block) { - $this->addBlock($block); - } - - $this->collBlocks = $blocks; - $this->collBlocksPartial = false; - - return $this; - } - - /** - * Returns the number of related Block objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related Block objects. - * @throws PropelException - */ - public function countBlocks(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - $partial = $this->collBlocksPartial && !$this->isNew(); - if (null === $this->collBlocks || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collBlocks) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getBlocks()); - } - $query = BlockQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByModel($this) - ->count($con); - } - - return count($this->collBlocks); - } - - /** - * Method called to associate a BaseBlock object to this object - * through the BaseBlock foreign key attribute. - * - * @param BaseBlock $l BaseBlock - * @return Model The current object (for fluent API support) - */ - public function addBlock(BaseBlock $l) - { - if ($this->collBlocks === null) { - $this->initBlocks(); - $this->collBlocksPartial = true; - } - - if (!in_array($l, $this->collBlocks->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddBlock($l); - - if ($this->blocksScheduledForDeletion and $this->blocksScheduledForDeletion->contains($l)) { - $this->blocksScheduledForDeletion->remove($this->blocksScheduledForDeletion->search($l)); - } - } - - return $this; - } - - /** - * @param Block $block The block object to add. - */ - protected function doAddBlock($block) - { - $this->collBlocks[]= $block; - $block->setModel($this); - } - - /** - * @param Block $block The block object to remove. - * @return Model The current object (for fluent API support) - */ - public function removeBlock($block) - { - if ($this->getBlocks()->contains($block)) { - $this->collBlocks->remove($this->collBlocks->search($block)); - if (null === $this->blocksScheduledForDeletion) { - $this->blocksScheduledForDeletion = clone $this->collBlocks; - $this->blocksScheduledForDeletion->clear(); - } - $this->blocksScheduledForDeletion[]= $block; - $block->setModel(null); - } - - return $this; - } - - /** - * Clears out the collModelVersions collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return Model The current object (for fluent API support) - * @see addModelVersions() - */ - public function clearModelVersions() - { - $this->collModelVersions = null; // important to set this to null since that means it is uninitialized - $this->collModelVersionsPartial = null; - - return $this; - } - - /** - * reset is the collModelVersions collection loaded partially - * - * @return void - */ - public function resetPartialModelVersions($v = true) - { - $this->collModelVersionsPartial = $v; - } - - /** - * Initializes the collModelVersions collection. - * - * By default this just sets the collModelVersions collection to an empty array (like clearcollModelVersions()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initModelVersions($overrideExisting = true) - { - if (null !== $this->collModelVersions && !$overrideExisting) { - return; - } - $this->collModelVersions = new PropelObjectCollection(); - $this->collModelVersions->setModel('ModelVersion'); - } - - /** - * Gets an array of ModelVersion objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this Model is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelObjectCollection|ModelVersion[] List of ModelVersion objects - * @throws PropelException - */ - public function getModelVersions($criteria = null, PropelPDO $con = null) - { - $partial = $this->collModelVersionsPartial && !$this->isNew(); - if (null === $this->collModelVersions || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collModelVersions) { - // return empty collection - $this->initModelVersions(); - } else { - $collModelVersions = ModelVersionQuery::create(null, $criteria) - ->filterByModel($this) - ->find($con); - if (null !== $criteria) { - if (false !== $this->collModelVersionsPartial && count($collModelVersions)) { - $this->initModelVersions(false); - - foreach ($collModelVersions as $obj) { - if (false == $this->collModelVersions->contains($obj)) { - $this->collModelVersions->append($obj); - } - } - - $this->collModelVersionsPartial = true; - } - - $collModelVersions->getInternalIterator()->rewind(); - - return $collModelVersions; - } - - if ($partial && $this->collModelVersions) { - foreach ($this->collModelVersions as $obj) { - if ($obj->isNew()) { - $collModelVersions[] = $obj; - } - } - } - - $this->collModelVersions = $collModelVersions; - $this->collModelVersionsPartial = false; - } - } - - return $this->collModelVersions; - } - - /** - * Sets a collection of ModelVersion objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param PropelCollection $modelVersions A Propel collection. - * @param PropelPDO $con Optional connection object - * @return Model The current object (for fluent API support) - */ - public function setModelVersions(PropelCollection $modelVersions, PropelPDO $con = null) - { - $modelVersionsToDelete = $this->getModelVersions(new Criteria(), $con)->diff($modelVersions); - - - //since at least one column in the foreign key is at the same time a PK - //we can not just set a PK to NULL in the lines below. We have to store - //a backup of all values, so we are able to manipulate these items based on the onDelete value later. - $this->modelVersionsScheduledForDeletion = clone $modelVersionsToDelete; - - foreach ($modelVersionsToDelete as $modelVersionRemoved) { - $modelVersionRemoved->setModel(null); - } - - $this->collModelVersions = null; - foreach ($modelVersions as $modelVersion) { - $this->addModelVersion($modelVersion); - } - - $this->collModelVersions = $modelVersions; - $this->collModelVersionsPartial = false; - - return $this; - } - - /** - * Returns the number of related ModelVersion objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related ModelVersion objects. - * @throws PropelException - */ - public function countModelVersions(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - $partial = $this->collModelVersionsPartial && !$this->isNew(); - if (null === $this->collModelVersions || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collModelVersions) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getModelVersions()); - } - $query = ModelVersionQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByModel($this) - ->count($con); - } - - return count($this->collModelVersions); - } - - /** - * Method called to associate a BaseModelVersion object to this object - * through the BaseModelVersion foreign key attribute. - * - * @param BaseModelVersion $l BaseModelVersion - * @return Model The current object (for fluent API support) - */ - public function addModelVersion(BaseModelVersion $l) - { - if ($this->collModelVersions === null) { - $this->initModelVersions(); - $this->collModelVersionsPartial = true; - } - - if (!in_array($l, $this->collModelVersions->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddModelVersion($l); - - if ($this->modelVersionsScheduledForDeletion and $this->modelVersionsScheduledForDeletion->contains($l)) { - $this->modelVersionsScheduledForDeletion->remove($this->modelVersionsScheduledForDeletion->search($l)); - } - } - - return $this; - } - - /** - * @param ModelVersion $modelVersion The modelVersion object to add. - */ - protected function doAddModelVersion($modelVersion) - { - $this->collModelVersions[]= $modelVersion; - $modelVersion->setModel($this); - } - - /** - * @param ModelVersion $modelVersion The modelVersion object to remove. - * @return Model The current object (for fluent API support) - */ - public function removeModelVersion($modelVersion) - { - if ($this->getModelVersions()->contains($modelVersion)) { - $this->collModelVersions->remove($this->collModelVersions->search($modelVersion)); - if (null === $this->modelVersionsScheduledForDeletion) { - $this->modelVersionsScheduledForDeletion = clone $this->collModelVersions; - $this->modelVersionsScheduledForDeletion->clear(); - } - $this->modelVersionsScheduledForDeletion[]= clone $modelVersion; - $modelVersion->setModel(null); - } - - return $this; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->name = null; - $this->template = null; - $this->class_key = null; - $this->created_at = null; - $this->updated_at = null; - $this->version = null; - $this->version_created_at = null; - $this->version_created_by = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->alreadyInClearAllReferencesDeep = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $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-volume/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep && !$this->alreadyInClearAllReferencesDeep) { - $this->alreadyInClearAllReferencesDeep = true; - if ($this->collNewsletters) { - foreach ($this->collNewsletters as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collBlocks) { - foreach ($this->collBlocks as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collModelVersions) { - foreach ($this->collModelVersions as $o) { - $o->clearAllReferences($deep); - } - } - - $this->alreadyInClearAllReferencesDeep = false; - } // if ($deep) - - if ($this->collNewsletters instanceof PropelCollection) { - $this->collNewsletters->clearIterator(); - } - $this->collNewsletters = null; - if ($this->collBlocks instanceof PropelCollection) { - $this->collBlocks->clearIterator(); - } - $this->collBlocks = null; - if ($this->collModelVersions instanceof PropelCollection) { - $this->collModelVersions->clearIterator(); - } - $this->collModelVersions = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(ModelPeer::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 Model The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = ModelPeer::UPDATED_AT; - - return $this; - } - - // versionable behavior - - /** - * Enforce a new Version of this object upon next save. - * - * @return Model - */ - public function enforceVersioning() - { - $this->enforceVersion = true; - - return $this; - } - - /** - * Checks whether the current state must be recorded as a version - * - * @param PropelPDO $con An optional PropelPDO connection to use. - * - * @return boolean - */ - public function isVersioningNecessary($con = null) - { - if ($this->alreadyInSave) { - return false; - } - - if ($this->enforceVersion) { - return true; - } - - if (ModelPeer::isVersioningEnabled() && ($this->isNew() || $this->isModified() || $this->isDeleted())) { - return true; - } - if ($this->collBlocks) { - // to avoid infinite loops, emulate in save - $this->alreadyInSave = true; - - foreach ($this->getBlocks(null, $con) as $relatedObject) { - if ($relatedObject->isVersioningNecessary($con)) { - $this->alreadyInSave = false; - - return true; - } - } - - $this->alreadyInSave = false; - } - - - return false; - } - - /** - * Creates a version of the current object and saves it. - * - * @param PropelPDO $con the connection to use - * - * @return ModelVersion A version object - */ - public function addVersion($con = null) - { - $this->enforceVersion = false; - - $version = new ModelVersion(); - $version->setId($this->getId()); - $version->setName($this->getName()); - $version->setTemplate($this->getTemplate()); - $version->setClassKey($this->getClassKey()); - $version->setCreatedAt($this->getCreatedAt()); - $version->setUpdatedAt($this->getUpdatedAt()); - $version->setVersion($this->getVersion()); - $version->setVersionCreatedAt($this->getVersionCreatedAt()); - $version->setVersionCreatedBy($this->getVersionCreatedBy()); - $version->setModel($this); - if ($relateds = $this->getBlocks($con)->toKeyValue('Id', 'Version')) { - $version->setNwsBlockIds(array_keys($relateds)); - $version->setNwsBlockVersions(array_values($relateds)); - } - $version->save($con); - - return $version; - } - - /** - * Sets the properties of the current object to the value they had at a specific version - * - * @param integer $versionNumber The version number to read - * @param PropelPDO $con the connection to use - * - * @return Model The current object (for fluent API support) - * @throws PropelException - if no object with the given version can be found. - */ - public function toVersion($versionNumber, $con = null) - { - $version = $this->getOneVersion($versionNumber, $con); - if (!$version) { - throw new PropelException(sprintf('No Model object found with version %d', $versionNumber)); - } - $this->populateFromVersion($version, $con); - - return $this; - } - - /** - * Sets the properties of the curent object to the value they had at a specific version - * - * @param ModelVersion $version The version object to use - * @param PropelPDO $con the connection to use - * @param array $loadedObjects objects thats been loaded in a chain of populateFromVersion calls on referrer or fk objects. - * - * @return Model The current object (for fluent API support) - */ - public function populateFromVersion($version, $con = null, &$loadedObjects = array()) - { - - $loadedObjects['Model'][$version->getId()][$version->getVersion()] = $this; - $this->setId($version->getId()); - $this->setName($version->getName()); - $this->setTemplate($version->getTemplate()); - $this->setClassKey($version->getClassKey()); - $this->setCreatedAt($version->getCreatedAt()); - $this->setUpdatedAt($version->getUpdatedAt()); - $this->setVersion($version->getVersion()); - $this->setVersionCreatedAt($version->getVersionCreatedAt()); - $this->setVersionCreatedBy($version->getVersionCreatedBy()); - if ($fkValues = $version->getNwsBlockIds()) { - $this->clearBlocks(); - $fkVersions = $version->getNwsBlockVersions(); - $query = BlockVersionQuery::create(); - foreach ($fkValues as $key => $value) { - $c1 = $query->getNewCriterion(BlockVersionPeer::ID, $value); - $c2 = $query->getNewCriterion(BlockVersionPeer::VERSION, $fkVersions[$key]); - $c1->addAnd($c2); - $query->addOr($c1); - } - foreach ($query->find($con) as $relatedVersion) { - if (isset($loadedObjects['Block']) && isset($loadedObjects['Block'][$relatedVersion->getId()]) && isset($loadedObjects['Block'][$relatedVersion->getId()][$relatedVersion->getVersion()])) { - $related = $loadedObjects['Block'][$relatedVersion->getId()][$relatedVersion->getVersion()]; - } else { - $related = new Block(); - $related->populateFromVersion($relatedVersion, $con, $loadedObjects); - $related->setNew(false); - } - $this->addBlock($related); - } - - $this->resetPartialBlocks(false); - } - - return $this; - } - - /** - * Gets the latest persisted version number for the current object - * - * @param PropelPDO $con the connection to use - * - * @return integer - */ - public function getLastVersionNumber($con = null) - { - $v = ModelVersionQuery::create() - ->filterByModel($this) - ->orderByVersion('desc') - ->findOne($con); - if (!$v) { - return 0; - } - - return $v->getVersion(); - } - - /** - * Checks whether the current object is the latest one - * - * @param PropelPDO $con the connection to use - * - * @return boolean - */ - public function isLastVersion($con = null) - { - return $this->getLastVersionNumber($con) == $this->getVersion(); - } - - /** - * Retrieves a version object for this entity and a version number - * - * @param integer $versionNumber The version number to read - * @param PropelPDO $con the connection to use - * - * @return ModelVersion A version object - */ - public function getOneVersion($versionNumber, $con = null) - { - return ModelVersionQuery::create() - ->filterByModel($this) - ->filterByVersion($versionNumber) - ->findOne($con); - } - - /** - * Gets all the versions of this object, in incremental order - * - * @param PropelPDO $con the connection to use - * - * @return PropelObjectCollection A list of ModelVersion objects - */ - public function getAllVersions($con = null) - { - $criteria = new Criteria(); - $criteria->addAscendingOrderByColumn(ModelVersionPeer::VERSION); - - return $this->getModelVersions($criteria, $con); - } - - /** - * Compares the current object with another of its version. - * - * print_r($book->compareVersion(1)); - * => array( - * '1' => array('Title' => 'Book title at version 1'), - * '2' => array('Title' => 'Book title at version 2') - * ); - * - * - * @param integer $versionNumber - * @param string $keys Main key used for the result diff (versions|columns) - * @param PropelPDO $con the connection to use - * @param array $ignoredColumns The columns to exclude from the diff. - * - * @return array A list of differences - */ - public function compareVersion($versionNumber, $keys = 'columns', $con = null, $ignoredColumns = array()) - { - $fromVersion = $this->toArray(); - $toVersion = $this->getOneVersion($versionNumber, $con)->toArray(); - - return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns); - } - - /** - * Compares two versions of the current object. - * - * print_r($book->compareVersions(1, 2)); - * => array( - * '1' => array('Title' => 'Book title at version 1'), - * '2' => array('Title' => 'Book title at version 2') - * ); - * - * - * @param integer $fromVersionNumber - * @param integer $toVersionNumber - * @param string $keys Main key used for the result diff (versions|columns) - * @param PropelPDO $con the connection to use - * @param array $ignoredColumns The columns to exclude from the diff. - * - * @return array A list of differences - */ - public function compareVersions($fromVersionNumber, $toVersionNumber, $keys = 'columns', $con = null, $ignoredColumns = array()) - { - $fromVersion = $this->getOneVersion($fromVersionNumber, $con)->toArray(); - $toVersion = $this->getOneVersion($toVersionNumber, $con)->toArray(); - - return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns); - } - - /** - * Computes the diff between two versions. - * - * print_r($this->computeDiff(1, 2)); - * => array( - * '1' => array('Title' => 'Book title at version 1'), - * '2' => array('Title' => 'Book title at version 2') - * ); - * - * - * @param array $fromVersion An array representing the original version. - * @param array $toVersion An array representing the destination version. - * @param string $keys Main key used for the result diff (versions|columns). - * @param array $ignoredColumns The columns to exclude from the diff. - * - * @return array A list of differences - */ - protected function computeDiff($fromVersion, $toVersion, $keys = 'columns', $ignoredColumns = array()) - { - $fromVersionNumber = $fromVersion['Version']; - $toVersionNumber = $toVersion['Version']; - $ignoredColumns = array_merge(array( - 'Version', - 'VersionCreatedAt', - 'VersionCreatedBy', - ), $ignoredColumns); - $diff = array(); - foreach ($fromVersion as $key => $value) { - if (in_array($key, $ignoredColumns)) { - continue; - } - if ($toVersion[$key] != $value) { - switch ($keys) { - case 'versions': - $diff[$fromVersionNumber][$key] = $value; - $diff[$toVersionNumber][$key] = $toVersion[$key]; - break; - default: - $diff[$key] = array( - $fromVersionNumber => $value, - $toVersionNumber => $toVersion[$key], - ); - break; - } - } - } - - return $diff; - } - /** - * retrieve the last $number versions. - * - * @param integer $number the number of record to return. - * @param ModelVersionQuery|Criteria $criteria Additional criteria to filter. - * @param PropelPDO $con An optional connection to use. - * - * @return PropelCollection|ModelVersion[] List of ModelVersion objects - */ - public function getLastVersions($number = 10, $criteria = null, PropelPDO $con = null) - { - $criteria = ModelVersionQuery::create(null, $criteria); - $criteria->addDescendingOrderByColumn(ModelVersionPeer::VERSION); - $criteria->limit($number); - - return $this->getModelVersions($criteria, $con); - } - // event behavior - public function preCommit(\PropelPDO $con = null){} - public function preCommitSave(\PropelPDO $con = null){} - public function preCommitDelete(\PropelPDO $con = null){} - public function preCommitUpdate(\PropelPDO $con = null){} - public function preCommitInsert(\PropelPDO $con = null){} - public function preRollback(\PropelPDO $con = null){} - public function preRollbackSave(\PropelPDO $con = null){} - public function preRollbackDelete(\PropelPDO $con = null){} - public function preRollbackUpdate(\PropelPDO $con = null){} - public function preRollbackInsert(\PropelPDO $con = null){} - -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelPeer.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelPeer.php deleted file mode 100644 index 7ed9e66..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelPeer.php +++ /dev/null @@ -1,915 +0,0 @@ - array ('Id', 'Name', 'Template', 'ClassKey', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'template', 'classKey', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), - BasePeer::TYPE_COLNAME => array (ModelPeer::ID, ModelPeer::NAME, ModelPeer::TEMPLATE, ModelPeer::CLASS_KEY, ModelPeer::CREATED_AT, ModelPeer::UPDATED_AT, ModelPeer::VERSION, ModelPeer::VERSION_CREATED_AT, ModelPeer::VERSION_CREATED_BY, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'TEMPLATE', 'CLASS_KEY', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'template', 'class_key', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), - 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. ModelPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'Template' => 2, 'ClassKey' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, 'Version' => 6, 'VersionCreatedAt' => 7, 'VersionCreatedBy' => 8, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'template' => 2, 'classKey' => 3, 'createdAt' => 4, 'updatedAt' => 5, 'version' => 6, 'versionCreatedAt' => 7, 'versionCreatedBy' => 8, ), - BasePeer::TYPE_COLNAME => array (ModelPeer::ID => 0, ModelPeer::NAME => 1, ModelPeer::TEMPLATE => 2, ModelPeer::CLASS_KEY => 3, ModelPeer::CREATED_AT => 4, ModelPeer::UPDATED_AT => 5, ModelPeer::VERSION => 6, ModelPeer::VERSION_CREATED_AT => 7, ModelPeer::VERSION_CREATED_BY => 8, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'TEMPLATE' => 2, 'CLASS_KEY' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, 'VERSION' => 6, 'VERSION_CREATED_AT' => 7, 'VERSION_CREATED_BY' => 8, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'template' => 2, 'class_key' => 3, 'created_at' => 4, 'updated_at' => 5, 'version' => 6, 'version_created_at' => 7, 'version_created_by' => 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 = ModelPeer::getFieldNames($toType); - $key = isset(ModelPeer::$fieldKeys[$fromType][$name]) ? ModelPeer::$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(ModelPeer::$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, ModelPeer::$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 ModelPeer::$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. ModelPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(ModelPeer::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(ModelPeer::ID); - $criteria->addSelectColumn(ModelPeer::NAME); - $criteria->addSelectColumn(ModelPeer::TEMPLATE); - $criteria->addSelectColumn(ModelPeer::CLASS_KEY); - $criteria->addSelectColumn(ModelPeer::CREATED_AT); - $criteria->addSelectColumn(ModelPeer::UPDATED_AT); - $criteria->addSelectColumn(ModelPeer::VERSION); - $criteria->addSelectColumn(ModelPeer::VERSION_CREATED_AT); - $criteria->addSelectColumn(ModelPeer::VERSION_CREATED_BY); - } else { - $criteria->addSelectColumn($alias . '.id'); - $criteria->addSelectColumn($alias . '.name'); - $criteria->addSelectColumn($alias . '.template'); - $criteria->addSelectColumn($alias . '.class_key'); - $criteria->addSelectColumn($alias . '.created_at'); - $criteria->addSelectColumn($alias . '.updated_at'); - $criteria->addSelectColumn($alias . '.version'); - $criteria->addSelectColumn($alias . '.version_created_at'); - $criteria->addSelectColumn($alias . '.version_created_by'); - } - } - - /** - * 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(ModelPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ModelPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(ModelPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(ModelPeer::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 Model - * @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 = ModelPeer::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 ModelPeer::populateObjects(ModelPeer::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 directly (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(ModelPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - ModelPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(ModelPeer::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 Model $obj A Model 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 - ModelPeer::$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 Model 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 Model) { - $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 Model object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(ModelPeer::$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 Model 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(ModelPeer::$instances[$key])) { - return ModelPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool($and_clear_all_references = false) - { - if ($and_clear_all_references) { - foreach (ModelPeer::$instances as $instance) { - $instance->clearAllReferences(true); - } - } - ModelPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to nws_model - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - // Invalidate objects in BlockPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - BlockPeer::clearInstancePool(); - // Invalidate objects in ModelVersionPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - ModelVersionPeer::clearInstancePool(); - } - - /** - * 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(); - - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = ModelPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = ModelPeer::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 { - // class must be set each time from the record row - $cls = ModelPeer::getOMClass($row, 0); - $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - ModelPeer::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 (Model object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = ModelPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = ModelPeer::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 + ModelPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = ModelPeer::getOMClass($row, $startcol); - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - ModelPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - /** - * 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(ModelPeer::DATABASE_NAME)->getTable(ModelPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseModelPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseModelPeer::TABLE_NAME)) { - $dbMap->addTableObject(new \Trinity\Bundle\NewsletterBundle\Model\map\ModelTableMap()); - } - } - - /** - * The returned Class will contain objects of the default type or - * objects that inherit from the default. - * - * @param array $row PropelPDO result row. - * @param int $colnum Column to examine for OM class information (first is 0). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getOMClass($row = 0, $colnum = 0) - { - try { - - $omClass = $row[$colnum + 3]; - $omClass = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - } catch (Exception $e) { - throw new PropelException('Unable to get OM class.', $e); - } - - - $event = new DetectOMClassEvent($omClass); - EventDispatcherProxy::trigger('om.detect', $event); - if($event->isDetected()){ - return $event->getDetectedClass(); - } - - return $omClass; - } - - /** - * Performs an INSERT on the database, given a Model or Criteria object. - * - * @param mixed $values Criteria or Model 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(ModelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Model object - } - - if ($criteria->containsKey(ModelPeer::ID) && $criteria->keyContainsValue(ModelPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ModelPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(ModelPeer::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 (Exception $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a Model or Criteria object. - * - * @param mixed $values Criteria or Model 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(ModelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(ModelPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(ModelPeer::ID); - $value = $criteria->remove(ModelPeer::ID); - if ($value) { - $selectCriteria->add(ModelPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(ModelPeer::TABLE_NAME); - } - - } else { // $values is Model object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(ModelPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the nws_model 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(ModelPeer::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 += ModelPeer::doOnDeleteCascade(new Criteria(ModelPeer::DATABASE_NAME), $con); - $affectedRows += BasePeer::doDeleteAll(ModelPeer::TABLE_NAME, $con, ModelPeer::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). - ModelPeer::clearInstancePool(); - ModelPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a Model or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Model 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(ModelPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof Model) { // it's a model object - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(ModelPeer::DATABASE_NAME); - $criteria->add(ModelPeer::ID, (array) $values, Criteria::IN); - } - - // Set the correct dbName - $criteria->setDbName(ModelPeer::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(); - - // cloning the Criteria in case it's modified by doSelect() or doSelectStmt() - $c = clone $criteria; - $affectedRows += ModelPeer::doOnDeleteCascade($c, $con); - - // 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). - if ($values instanceof Criteria) { - ModelPeer::clearInstancePool(); - } elseif ($values instanceof Model) { // it's a model object - ModelPeer::removeInstanceFromPool($values); - } else { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { - ModelPeer::removeInstanceFromPool($singleval); - } - } - - $affectedRows += BasePeer::doDelete($criteria, $con); - ModelPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * This is a method for emulating ON DELETE CASCADE for DBs that don't support this - * feature (like MySQL or SQLite). - * - * This method is not very speedy because it must perform a query first to get - * the implicated records and then perform the deletes by calling those Peer classes. - * - * This method should be used within a transaction if possible. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @return int The number of affected rows (if supported by underlying database driver). - */ - protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) - { - // initialize var to track total num of affected rows - $affectedRows = 0; - - // first find the objects that are implicated by the $criteria - $objects = ModelPeer::doSelect($criteria, $con); - foreach ($objects as $obj) { - - - // delete related Block objects - $criteria = new Criteria(BlockPeer::DATABASE_NAME); - - $criteria->add(BlockPeer::MODEL_ID, $obj->getId()); - $affectedRows += BlockPeer::doDelete($criteria, $con); - - // delete related ModelVersion objects - $criteria = new Criteria(ModelVersionPeer::DATABASE_NAME); - - $criteria->add(ModelVersionPeer::ID, $obj->getId()); - $affectedRows += ModelVersionPeer::doDelete($criteria, $con); - } - - return $affectedRows; - } - - /** - * Validates all modified columns of given Model 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 Model $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(ModelPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(ModelPeer::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(ModelPeer::DATABASE_NAME, ModelPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return Model - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = ModelPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(ModelPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(ModelPeer::DATABASE_NAME); - $criteria->add(ModelPeer::ID, $pk); - - $v = ModelPeer::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 Model[] - * @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(ModelPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(ModelPeer::DATABASE_NAME); - $criteria->add(ModelPeer::ID, $pks, Criteria::IN); - $objs = ModelPeer::doSelect($criteria, $con); - } - - return $objs; - } - - // versionable behavior - - /** - * Checks whether versioning is enabled - * - * @return boolean - */ - public static function isVersioningEnabled() - { - return self::$isVersioningEnabled; - } - - /** - * Enables versioning - */ - public static function enableVersioning() - { - self::$isVersioningEnabled = true; - } - - /** - * Disables versioning - */ - public static function disableVersioning() - { - self::$isVersioningEnabled = false; - } - -} // BaseModelPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseModelPeer::buildTableMap(); - -EventDispatcherProxy::trigger(array('construct','peer.construct'), new PeerEvent('Trinity\Bundle\NewsletterBundle\Model\om\BaseModelPeer')); diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelQuery.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelQuery.php deleted file mode 100644 index 9f746b2..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelQuery.php +++ /dev/null @@ -1,988 +0,0 @@ -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 Model|Model[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = ModelPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is already in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(ModelPeer::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); - } - } - - /** - * Alias of findPk to use instance pooling - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return Model A model object, or null if the key is not found - * @throws PropelException - */ - public function findOneById($key, $con = null) - { - return $this->findPk($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 Model A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `id`, `name`, `template`, `class_key`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by` FROM `nws_model` 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)) { - $cls = ModelPeer::getOMClass($row, 0); - $obj = new $cls(); - $obj->hydrate($row); - ModelPeer::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 Model|Model[]|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|Model[]|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 ModelQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(ModelPeer::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 ModelQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(ModelPeer::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 - * $query->filterById(array('max' => 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 ModelQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id)) { - $useMinMax = false; - if (isset($id['min'])) { - $this->addUsingAlias(ModelPeer::ID, $id['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($id['max'])) { - $this->addUsingAlias(ModelPeer::ID, $id['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModelPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the name column - * - * Example usage: - * - * $query->filterByName('fooValue'); // WHERE name = 'fooValue' - * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' - * - * - * @param string $name 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 ModelQuery The current query, for fluid interface - */ - public function filterByName($name = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($name)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $name)) { - $name = str_replace('*', '%', $name); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModelPeer::NAME, $name, $comparison); - } - - /** - * Filter the query on the template column - * - * Example usage: - * - * $query->filterByTemplate('fooValue'); // WHERE template = 'fooValue' - * $query->filterByTemplate('%fooValue%'); // WHERE template LIKE '%fooValue%' - * - * - * @param string $template 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 ModelQuery The current query, for fluid interface - */ - public function filterByTemplate($template = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($template)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $template)) { - $template = str_replace('*', '%', $template); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModelPeer::TEMPLATE, $template, $comparison); - } - - /** - * Filter the query on the class_key column - * - * Example usage: - * - * $query->filterByClassKey('fooValue'); // WHERE class_key = 'fooValue' - * $query->filterByClassKey('%fooValue%'); // WHERE class_key LIKE '%fooValue%' - * - * - * @param string $classKey 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 ModelQuery The current query, for fluid interface - */ - public function filterByClassKey($classKey = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($classKey)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $classKey)) { - $classKey = str_replace('*', '%', $classKey); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModelPeer::CLASS_KEY, $classKey, $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 ModelQuery 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(ModelPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(ModelPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModelPeer::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 ModelQuery 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(ModelPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(ModelPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModelPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query on the version column - * - * Example usage: - * - * $query->filterByVersion(1234); // WHERE version = 1234 - * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34) - * $query->filterByVersion(array('min' => 12)); // WHERE version >= 12 - * $query->filterByVersion(array('max' => 12)); // WHERE version <= 12 - * - * - * @param mixed $version 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 ModelQuery The current query, for fluid interface - */ - public function filterByVersion($version = null, $comparison = null) - { - if (is_array($version)) { - $useMinMax = false; - if (isset($version['min'])) { - $this->addUsingAlias(ModelPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($version['max'])) { - $this->addUsingAlias(ModelPeer::VERSION, $version['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModelPeer::VERSION, $version, $comparison); - } - - /** - * Filter the query on the version_created_at column - * - * Example usage: - * - * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14' - * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14' - * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at < '2011-03-13' - * - * - * @param mixed $versionCreatedAt 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 ModelQuery The current query, for fluid interface - */ - public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null) - { - if (is_array($versionCreatedAt)) { - $useMinMax = false; - if (isset($versionCreatedAt['min'])) { - $this->addUsingAlias(ModelPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($versionCreatedAt['max'])) { - $this->addUsingAlias(ModelPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModelPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison); - } - - /** - * Filter the query on the version_created_by column - * - * Example usage: - * - * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue' - * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%' - * - * - * @param string $versionCreatedBy 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 ModelQuery The current query, for fluid interface - */ - public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($versionCreatedBy)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) { - $versionCreatedBy = str_replace('*', '%', $versionCreatedBy); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModelPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison); - } - - /** - * Filter the query by a related Newsletter object - * - * @param Newsletter|PropelObjectCollection $newsletter the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModelQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByNewsletter($newsletter, $comparison = null) - { - if ($newsletter instanceof Newsletter) { - return $this - ->addUsingAlias(ModelPeer::ID, $newsletter->getModelId(), $comparison); - } elseif ($newsletter instanceof PropelObjectCollection) { - return $this - ->useNewsletterQuery() - ->filterByPrimaryKeys($newsletter->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByNewsletter() only accepts arguments of type Newsletter or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Newsletter relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ModelQuery The current query, for fluid interface - */ - public function joinNewsletter($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Newsletter'); - - // 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, 'Newsletter'); - } - - return $this; - } - - /** - * Use the Newsletter relation Newsletter 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 \Trinity\Bundle\NewsletterBundle\Model\NewsletterQuery A secondary query class using the current class as primary query - */ - public function useNewsletterQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinNewsletter($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Newsletter', '\Trinity\Bundle\NewsletterBundle\Model\NewsletterQuery'); - } - - /** - * Filter the query by a related Block object - * - * @param Block|PropelObjectCollection $block the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModelQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByBlock($block, $comparison = null) - { - if ($block instanceof Block) { - return $this - ->addUsingAlias(ModelPeer::ID, $block->getModelId(), $comparison); - } elseif ($block instanceof PropelObjectCollection) { - return $this - ->useBlockQuery() - ->filterByPrimaryKeys($block->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByBlock() only accepts arguments of type Block or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Block relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ModelQuery The current query, for fluid interface - */ - public function joinBlock($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Block'); - - // 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, 'Block'); - } - - return $this; - } - - /** - * Use the Block relation Block 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 \Trinity\Bundle\NewsletterBundle\Model\BlockQuery A secondary query class using the current class as primary query - */ - public function useBlockQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinBlock($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Block', '\Trinity\Bundle\NewsletterBundle\Model\BlockQuery'); - } - - /** - * Filter the query by a related ModelVersion object - * - * @param ModelVersion|PropelObjectCollection $modelVersion the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModelQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByModelVersion($modelVersion, $comparison = null) - { - if ($modelVersion instanceof ModelVersion) { - return $this - ->addUsingAlias(ModelPeer::ID, $modelVersion->getId(), $comparison); - } elseif ($modelVersion instanceof PropelObjectCollection) { - return $this - ->useModelVersionQuery() - ->filterByPrimaryKeys($modelVersion->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByModelVersion() only accepts arguments of type ModelVersion or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the ModelVersion relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ModelQuery The current query, for fluid interface - */ - public function joinModelVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ModelVersion'); - - // 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, 'ModelVersion'); - } - - return $this; - } - - /** - * Use the ModelVersion relation ModelVersion 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 \Trinity\Bundle\NewsletterBundle\Model\ModelVersionQuery A secondary query class using the current class as primary query - */ - public function useModelVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinModelVersion($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ModelVersion', '\Trinity\Bundle\NewsletterBundle\Model\ModelVersionQuery'); - } - - /** - * Exclude object from result - * - * @param Model $model Object to remove from the list of results - * - * @return ModelQuery The current query, for fluid interface - */ - public function prune($model = null) - { - if ($model) { - $this->addUsingAlias(ModelPeer::ID, $model->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - /** - * Code to execute before every SELECT statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreSelect(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger('query.select.pre', new QueryEvent($this)); - - return $this->preSelect($con); - } - - /** - * Code to execute before every DELETE statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreDelete(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','query.delete.pre'), new QueryEvent($this)); - - return $this->preDelete($con); - } - - /** - * Code to execute after every DELETE statement - * - * @param int $affectedRows the number of deleted rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostDelete($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.post','query.delete.post'), new QueryEvent($this)); - - return $this->postDelete($affectedRows, $con); - } - - /** - * Code to execute before every UPDATE statement - * - * @param array $values The associative array of columns and values for the update - * @param PropelPDO $con The connection object used by the query - * @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), otherwise it is a series of save() calls on all the found objects - */ - protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false) - { - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'query.update.pre'), new QueryEvent($this)); - - return $this->preUpdate($values, $con, $forceIndividualSaves); - } - - /** - * Code to execute after every UPDATE statement - * - * @param int $affectedRows the number of updated rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostUpdate($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'query.update.post'), new QueryEvent($this)); - - return $this->postUpdate($affectedRows, $con); - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return ModelQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(ModelPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return ModelQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(ModelPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return ModelQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(ModelPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return ModelQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(ModelPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return ModelQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(ModelPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return ModelQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(ModelPeer::CREATED_AT); - } - // extend behavior - public function setFormatter($formatter) - { - if (is_string($formatter) && $formatter === \ModelCriteria::FORMAT_ON_DEMAND) { - $formatter = '\Glorpen\Propel\PropelBundle\Formatter\PropelOnDemandFormatter'; - } - - return parent::setFormatter($formatter); - } -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelVersion.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelVersion.php deleted file mode 100644 index d1f050d..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelVersion.php +++ /dev/null @@ -1,1722 +0,0 @@ -version = 0; - } - - /** - * Initializes internal state of BaseModelVersion object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - EventDispatcherProxy::trigger(array('construct','model.construct'), new ModelEvent($this)); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getId() - { - - return $this->id; - } - - /** - * Get the [name] column value. - * - * @return string - */ - public function getName() - { - - return $this->name; - } - - /** - * Get the [template] column value. - * - * @return string - */ - public function getTemplate() - { - - return $this->template; - } - - /** - * Get the [class_key] column value. - * - * @return string - */ - public function getClassKey() - { - - return $this->class_key; - } - - /** - * 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 = null) - { - 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; - } - - 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; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - 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 = null) - { - 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; - } - - 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; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * Get the [version] column value. - * - * @return int - */ - public function getVersion() - { - - return $this->version; - } - - /** - * Get the [optionally formatted] temporal [version_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 getVersionCreatedAt($format = null) - { - if ($this->version_created_at === null) { - return null; - } - - if ($this->version_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; - } - - try { - $dt = new DateTime($this->version_created_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * Get the [version_created_by] column value. - * - * @return string - */ - public function getVersionCreatedBy() - { - - return $this->version_created_by; - } - - /** - * Get the [nws_block_ids] column value. - * - * @return array - */ - public function getNwsBlockIds() - { - if (null === $this->nws_block_ids_unserialized) { - $this->nws_block_ids_unserialized = array(); - } - if (!$this->nws_block_ids_unserialized && null !== $this->nws_block_ids) { - $nws_block_ids_unserialized = substr($this->nws_block_ids, 2, -2); - $this->nws_block_ids_unserialized = $nws_block_ids_unserialized ? explode(' | ', $nws_block_ids_unserialized) : array(); - } - - return $this->nws_block_ids_unserialized; - } - - /** - * Test the presence of a value in the [nws_block_ids] array column value. - * @param mixed $value - * - * @return boolean - */ - public function hasNwsBlockId($value) - { - return in_array($value, $this->getNwsBlockIds()); - } // hasNwsBlockId() - - /** - * Get the [nws_block_versions] column value. - * - * @return array - */ - public function getNwsBlockVersions() - { - if (null === $this->nws_block_versions_unserialized) { - $this->nws_block_versions_unserialized = array(); - } - if (!$this->nws_block_versions_unserialized && null !== $this->nws_block_versions) { - $nws_block_versions_unserialized = substr($this->nws_block_versions, 2, -2); - $this->nws_block_versions_unserialized = $nws_block_versions_unserialized ? explode(' | ', $nws_block_versions_unserialized) : array(); - } - - return $this->nws_block_versions_unserialized; - } - - /** - * Test the presence of a value in the [nws_block_versions] array column value. - * @param mixed $value - * - * @return boolean - */ - public function hasNwsBlockVersion($value) - { - return in_array($value, $this->getNwsBlockVersions()); - } // hasNwsBlockVersion() - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return ModelVersion The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = ModelVersionPeer::ID; - } - - if ($this->aModel !== null && $this->aModel->getId() !== $v) { - $this->aModel = null; - } - - - return $this; - } // setId() - - /** - * Set the value of [name] column. - * - * @param string $v new value - * @return ModelVersion The current object (for fluent API support) - */ - public function setName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->name !== $v) { - $this->name = $v; - $this->modifiedColumns[] = ModelVersionPeer::NAME; - } - - - return $this; - } // setName() - - /** - * Set the value of [template] column. - * - * @param string $v new value - * @return ModelVersion The current object (for fluent API support) - */ - public function setTemplate($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->template !== $v) { - $this->template = $v; - $this->modifiedColumns[] = ModelVersionPeer::TEMPLATE; - } - - - return $this; - } // setTemplate() - - /** - * Set the value of [class_key] column. - * - * @param string $v new value - * @return ModelVersion The current object (for fluent API support) - */ - public function setClassKey($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->class_key !== $v) { - $this->class_key = $v; - $this->modifiedColumns[] = ModelVersionPeer::CLASS_KEY; - } - - - return $this; - } // setClassKey() - - /** - * 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 ModelVersion 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[] = ModelVersionPeer::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 ModelVersion 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[] = ModelVersionPeer::UPDATED_AT; - } - } // if either are not null - - - return $this; - } // setUpdatedAt() - - /** - * Set the value of [version] column. - * - * @param int $v new value - * @return ModelVersion The current object (for fluent API support) - */ - public function setVersion($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->version !== $v) { - $this->version = $v; - $this->modifiedColumns[] = ModelVersionPeer::VERSION; - } - - - return $this; - } // setVersion() - - /** - * Sets the value of [version_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 ModelVersion The current object (for fluent API support) - */ - public function setVersionCreatedAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->version_created_at !== null || $dt !== null) { - $currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_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->version_created_at = $newDateAsString; - $this->modifiedColumns[] = ModelVersionPeer::VERSION_CREATED_AT; - } - } // if either are not null - - - return $this; - } // setVersionCreatedAt() - - /** - * Set the value of [version_created_by] column. - * - * @param string $v new value - * @return ModelVersion The current object (for fluent API support) - */ - public function setVersionCreatedBy($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->version_created_by !== $v) { - $this->version_created_by = $v; - $this->modifiedColumns[] = ModelVersionPeer::VERSION_CREATED_BY; - } - - - return $this; - } // setVersionCreatedBy() - - /** - * Set the value of [nws_block_ids] column. - * - * @param array $v new value - * @return ModelVersion The current object (for fluent API support) - */ - public function setNwsBlockIds($v) - { - if ($this->nws_block_ids_unserialized !== $v) { - $this->nws_block_ids_unserialized = $v; - $this->nws_block_ids = '| ' . implode(' | ', (array) $v) . ' |'; - $this->modifiedColumns[] = ModelVersionPeer::NWS_BLOCK_IDS; - } - - - return $this; - } // setNwsBlockIds() - - /** - * Adds a value to the [nws_block_ids] array column value. - * @param mixed $value - * - * @return ModelVersion The current object (for fluent API support) - */ - public function addNwsBlockId($value) - { - $currentArray = $this->getNwsBlockIds(); - $currentArray []= $value; - $this->setNwsBlockIds($currentArray); - - return $this; - } // addNwsBlockId() - - /** - * Removes a value from the [nws_block_ids] array column value. - * @param mixed $value - * - * @return ModelVersion The current object (for fluent API support) - */ - public function removeNwsBlockId($value) - { - $targetArray = array(); - foreach ($this->getNwsBlockIds() as $element) { - if ($element != $value) { - $targetArray []= $element; - } - } - $this->setNwsBlockIds($targetArray); - - return $this; - } // removeNwsBlockId() - - /** - * Set the value of [nws_block_versions] column. - * - * @param array $v new value - * @return ModelVersion The current object (for fluent API support) - */ - public function setNwsBlockVersions($v) - { - if ($this->nws_block_versions_unserialized !== $v) { - $this->nws_block_versions_unserialized = $v; - $this->nws_block_versions = '| ' . implode(' | ', (array) $v) . ' |'; - $this->modifiedColumns[] = ModelVersionPeer::NWS_BLOCK_VERSIONS; - } - - - return $this; - } // setNwsBlockVersions() - - /** - * Adds a value to the [nws_block_versions] array column value. - * @param mixed $value - * - * @return ModelVersion The current object (for fluent API support) - */ - public function addNwsBlockVersion($value) - { - $currentArray = $this->getNwsBlockVersions(); - $currentArray []= $value; - $this->setNwsBlockVersions($currentArray); - - return $this; - } // addNwsBlockVersion() - - /** - * Removes a value from the [nws_block_versions] array column value. - * @param mixed $value - * - * @return ModelVersion The current object (for fluent API support) - */ - public function removeNwsBlockVersion($value) - { - $targetArray = array(); - foreach ($this->getNwsBlockVersions() as $element) { - if ($element != $value) { - $targetArray []= $element; - } - } - $this->setNwsBlockVersions($targetArray); - - return $this; - } // removeNwsBlockVersion() - - /** - * 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() - { - if ($this->version !== 0) { - return false; - } - - // 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 resultset 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->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->template = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->class_key = ($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->version = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; - $this->version_created_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->version_created_by = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->nws_block_ids = $row[$startcol + 9]; - $this->nws_block_ids_unserialized = null; - $this->nws_block_versions = $row[$startcol + 10]; - $this->nws_block_versions_unserialized = null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - $this->postHydrate($row, $startcol, $rehydrate); - - return $startcol + 11; // 11 = ModelVersionPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating ModelVersion 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->aModel !== null && $this->id !== $this->aModel->getId()) { - $this->aModel = 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(ModelVersionPeer::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 = ModelVersionPeer::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->aModel = 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(ModelVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = ModelVersionQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','model.delete.pre'), new ModelEvent($this)); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.post', 'model.delete.post'), new ModelEvent($this)); - $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(ModelVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - // event behavior - EventDispatcherProxy::trigger('model.save.pre', new ModelEvent($this)); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // event behavior - EventDispatcherProxy::trigger('model.insert.pre', new ModelEvent($this)); - } else { - $ret = $ret && $this->preUpdate($con); - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'model.update.pre'), new ModelEvent($this)); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - // event behavior - EventDispatcherProxy::trigger('model.insert.post', new ModelEvent($this)); - } else { - $this->postUpdate($con); - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'model.update.post'), new ModelEvent($this)); - } - $this->postSave($con); - // event behavior - EventDispatcherProxy::trigger('model.save.post', new ModelEvent($this)); - ModelVersionPeer::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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aModel !== null) { - if ($this->aModel->isModified() || $this->aModel->isNew()) { - $affectedRows += $this->aModel->save($con); - } - $this->setModel($this->aModel); - } - - 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(ModelVersionPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`id`'; - } - if ($this->isColumnModified(ModelVersionPeer::NAME)) { - $modifiedColumns[':p' . $index++] = '`name`'; - } - if ($this->isColumnModified(ModelVersionPeer::TEMPLATE)) { - $modifiedColumns[':p' . $index++] = '`template`'; - } - if ($this->isColumnModified(ModelVersionPeer::CLASS_KEY)) { - $modifiedColumns[':p' . $index++] = '`class_key`'; - } - if ($this->isColumnModified(ModelVersionPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`created_at`'; - } - if ($this->isColumnModified(ModelVersionPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`updated_at`'; - } - if ($this->isColumnModified(ModelVersionPeer::VERSION)) { - $modifiedColumns[':p' . $index++] = '`version`'; - } - if ($this->isColumnModified(ModelVersionPeer::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`version_created_at`'; - } - if ($this->isColumnModified(ModelVersionPeer::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = '`version_created_by`'; - } - if ($this->isColumnModified(ModelVersionPeer::NWS_BLOCK_IDS)) { - $modifiedColumns[':p' . $index++] = '`nws_block_ids`'; - } - if ($this->isColumnModified(ModelVersionPeer::NWS_BLOCK_VERSIONS)) { - $modifiedColumns[':p' . $index++] = '`nws_block_versions`'; - } - - $sql = sprintf( - 'INSERT INTO `nws_model_version` (%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 '`name`': - $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); - break; - case '`template`': - $stmt->bindValue($identifier, $this->template, PDO::PARAM_STR); - break; - case '`class_key`': - $stmt->bindValue($identifier, $this->class_key, 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; - case '`version`': - $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); - break; - case '`version_created_at`': - $stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR); - break; - case '`version_created_by`': - $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); - break; - case '`nws_block_ids`': - $stmt->bindValue($identifier, $this->nws_block_ids, PDO::PARAM_STR); - break; - case '`nws_block_versions`': - $stmt->bindValue($identifier, $this->nws_block_versions, 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; - } - - $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 aggregated 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 objects 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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aModel !== null) { - if (!$this->aModel->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aModel->getValidationFailures()); - } - } - - - if (($retval = ModelVersionPeer::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 = ModelVersionPeer::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->getName(); - break; - case 2: - return $this->getTemplate(); - break; - case 3: - return $this->getClassKey(); - break; - case 4: - return $this->getCreatedAt(); - break; - case 5: - return $this->getUpdatedAt(); - break; - case 6: - return $this->getVersion(); - break; - case 7: - return $this->getVersionCreatedAt(); - break; - case 8: - return $this->getVersionCreatedBy(); - break; - case 9: - return $this->getNwsBlockIds(); - break; - case 10: - return $this->getNwsBlockVersions(); - 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['ModelVersion'][serialize($this->getPrimaryKey())])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['ModelVersion'][serialize($this->getPrimaryKey())] = true; - $keys = ModelVersionPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getName(), - $keys[2] => $this->getTemplate(), - $keys[3] => $this->getClassKey(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), - $keys[6] => $this->getVersion(), - $keys[7] => $this->getVersionCreatedAt(), - $keys[8] => $this->getVersionCreatedBy(), - $keys[9] => $this->getNwsBlockIds(), - $keys[10] => $this->getNwsBlockVersions(), - ); - $virtualColumns = $this->virtualColumns; - foreach ($virtualColumns as $key => $virtualColumn) { - $result[$key] = $virtualColumn; - } - - if ($includeForeignObjects) { - if (null !== $this->aModel) { - $result['Model'] = $this->aModel->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 = ModelVersionPeer::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->setName($value); - break; - case 2: - $this->setTemplate($value); - break; - case 3: - $this->setClassKey($value); - break; - case 4: - $this->setCreatedAt($value); - break; - case 5: - $this->setUpdatedAt($value); - break; - case 6: - $this->setVersion($value); - break; - case 7: - $this->setVersionCreatedAt($value); - break; - case 8: - $this->setVersionCreatedBy($value); - break; - case 9: - if (!is_array($value)) { - $v = trim(substr($value, 2, -2)); - $value = $v ? explode(' | ', $v) : array(); - } - $this->setNwsBlockIds($value); - break; - case 10: - if (!is_array($value)) { - $v = trim(substr($value, 2, -2)); - $value = $v ? explode(' | ', $v) : array(); - } - $this->setNwsBlockVersions($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 = ModelVersionPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setTemplate($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setClassKey($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]]); - if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedBy($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setNwsBlockIds($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setNwsBlockVersions($arr[$keys[10]]); - } - - /** - * 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(ModelVersionPeer::DATABASE_NAME); - - if ($this->isColumnModified(ModelVersionPeer::ID)) $criteria->add(ModelVersionPeer::ID, $this->id); - if ($this->isColumnModified(ModelVersionPeer::NAME)) $criteria->add(ModelVersionPeer::NAME, $this->name); - if ($this->isColumnModified(ModelVersionPeer::TEMPLATE)) $criteria->add(ModelVersionPeer::TEMPLATE, $this->template); - if ($this->isColumnModified(ModelVersionPeer::CLASS_KEY)) $criteria->add(ModelVersionPeer::CLASS_KEY, $this->class_key); - if ($this->isColumnModified(ModelVersionPeer::CREATED_AT)) $criteria->add(ModelVersionPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ModelVersionPeer::UPDATED_AT)) $criteria->add(ModelVersionPeer::UPDATED_AT, $this->updated_at); - if ($this->isColumnModified(ModelVersionPeer::VERSION)) $criteria->add(ModelVersionPeer::VERSION, $this->version); - if ($this->isColumnModified(ModelVersionPeer::VERSION_CREATED_AT)) $criteria->add(ModelVersionPeer::VERSION_CREATED_AT, $this->version_created_at); - if ($this->isColumnModified(ModelVersionPeer::VERSION_CREATED_BY)) $criteria->add(ModelVersionPeer::VERSION_CREATED_BY, $this->version_created_by); - if ($this->isColumnModified(ModelVersionPeer::NWS_BLOCK_IDS)) $criteria->add(ModelVersionPeer::NWS_BLOCK_IDS, $this->nws_block_ids); - if ($this->isColumnModified(ModelVersionPeer::NWS_BLOCK_VERSIONS)) $criteria->add(ModelVersionPeer::NWS_BLOCK_VERSIONS, $this->nws_block_versions); - - 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(ModelVersionPeer::DATABASE_NAME); - $criteria->add(ModelVersionPeer::ID, $this->id); - $criteria->add(ModelVersionPeer::VERSION, $this->version); - - return $criteria; - } - - /** - * Returns the composite primary key for this object. - * The array elements will be in same order as specified in XML. - * @return array - */ - public function getPrimaryKey() - { - $pks = array(); - $pks[0] = $this->getId(); - $pks[1] = $this->getVersion(); - - return $pks; - } - - /** - * Set the [composite] primary key. - * - * @param array $keys The elements of the composite key (order must match the order in XML file). - * @return void - */ - public function setPrimaryKey($keys) - { - $this->setId($keys[0]); - $this->setVersion($keys[1]); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return (null === $this->getId()) && (null === $this->getVersion()); - } - - /** - * 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 ModelVersion (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->setId($this->getId()); - $copyObj->setName($this->getName()); - $copyObj->setTemplate($this->getTemplate()); - $copyObj->setClassKey($this->getClassKey()); - $copyObj->setCreatedAt($this->getCreatedAt()); - $copyObj->setUpdatedAt($this->getUpdatedAt()); - $copyObj->setVersion($this->getVersion()); - $copyObj->setVersionCreatedAt($this->getVersionCreatedAt()); - $copyObj->setVersionCreatedBy($this->getVersionCreatedBy()); - $copyObj->setNwsBlockIds($this->getNwsBlockIds()); - $copyObj->setNwsBlockVersions($this->getNwsBlockVersions()); - - 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); - } - } - - /** - * 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 ModelVersion 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 ModelVersionPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new ModelVersionPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Model object. - * - * @param Model $v - * @return ModelVersion The current object (for fluent API support) - * @throws PropelException - */ - public function setModel(Model $v = null) - { - if ($v === null) { - $this->setId(NULL); - } else { - $this->setId($v->getId()); - } - - $this->aModel = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Model object, it will not be re-added. - if ($v !== null) { - $v->addModelVersion($this); - } - - - return $this; - } - - - /** - * Get the associated Model object - * - * @param PropelPDO $con Optional Connection object. - * @param $doQuery Executes a query to get the object if required - * @return Model The associated Model object. - * @throws PropelException - */ - public function getModel(PropelPDO $con = null, $doQuery = true) - { - if ($this->aModel === null && ($this->id !== null) && $doQuery) { - $this->aModel = ModelQuery::create()->findPk($this->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->aModel->addModelVersions($this); - */ - } - - return $this->aModel; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->name = null; - $this->template = null; - $this->class_key = null; - $this->created_at = null; - $this->updated_at = null; - $this->version = null; - $this->version_created_at = null; - $this->version_created_by = null; - $this->nws_block_ids = null; - $this->nws_block_ids_unserialized = null; - $this->nws_block_versions = null; - $this->nws_block_versions_unserialized = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->alreadyInClearAllReferencesDeep = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $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-volume/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep && !$this->alreadyInClearAllReferencesDeep) { - $this->alreadyInClearAllReferencesDeep = true; - if ($this->aModel instanceof Persistent) { - $this->aModel->clearAllReferences($deep); - } - - $this->alreadyInClearAllReferencesDeep = false; - } // if ($deep) - - $this->aModel = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(ModelVersionPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // event behavior - public function preCommit(\PropelPDO $con = null){} - public function preCommitSave(\PropelPDO $con = null){} - public function preCommitDelete(\PropelPDO $con = null){} - public function preCommitUpdate(\PropelPDO $con = null){} - public function preCommitInsert(\PropelPDO $con = null){} - public function preRollback(\PropelPDO $con = null){} - public function preRollbackSave(\PropelPDO $con = null){} - public function preRollbackDelete(\PropelPDO $con = null){} - public function preRollbackUpdate(\PropelPDO $con = null){} - public function preRollbackInsert(\PropelPDO $con = null){} - -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelVersionPeer.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelVersionPeer.php deleted file mode 100644 index df2cd0e..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelVersionPeer.php +++ /dev/null @@ -1,1060 +0,0 @@ - array ('Id', 'Name', 'Template', 'ClassKey', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', 'NwsBlockIds', 'NwsBlockVersions', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'template', 'classKey', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', 'nwsBlockIds', 'nwsBlockVersions', ), - BasePeer::TYPE_COLNAME => array (ModelVersionPeer::ID, ModelVersionPeer::NAME, ModelVersionPeer::TEMPLATE, ModelVersionPeer::CLASS_KEY, ModelVersionPeer::CREATED_AT, ModelVersionPeer::UPDATED_AT, ModelVersionPeer::VERSION, ModelVersionPeer::VERSION_CREATED_AT, ModelVersionPeer::VERSION_CREATED_BY, ModelVersionPeer::NWS_BLOCK_IDS, ModelVersionPeer::NWS_BLOCK_VERSIONS, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'TEMPLATE', 'CLASS_KEY', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', 'NWS_BLOCK_IDS', 'NWS_BLOCK_VERSIONS', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'template', 'class_key', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', 'nws_block_ids', 'nws_block_versions', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. ModelVersionPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'Template' => 2, 'ClassKey' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, 'Version' => 6, 'VersionCreatedAt' => 7, 'VersionCreatedBy' => 8, 'NwsBlockIds' => 9, 'NwsBlockVersions' => 10, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'template' => 2, 'classKey' => 3, 'createdAt' => 4, 'updatedAt' => 5, 'version' => 6, 'versionCreatedAt' => 7, 'versionCreatedBy' => 8, 'nwsBlockIds' => 9, 'nwsBlockVersions' => 10, ), - BasePeer::TYPE_COLNAME => array (ModelVersionPeer::ID => 0, ModelVersionPeer::NAME => 1, ModelVersionPeer::TEMPLATE => 2, ModelVersionPeer::CLASS_KEY => 3, ModelVersionPeer::CREATED_AT => 4, ModelVersionPeer::UPDATED_AT => 5, ModelVersionPeer::VERSION => 6, ModelVersionPeer::VERSION_CREATED_AT => 7, ModelVersionPeer::VERSION_CREATED_BY => 8, ModelVersionPeer::NWS_BLOCK_IDS => 9, ModelVersionPeer::NWS_BLOCK_VERSIONS => 10, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'TEMPLATE' => 2, 'CLASS_KEY' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, 'VERSION' => 6, 'VERSION_CREATED_AT' => 7, 'VERSION_CREATED_BY' => 8, 'NWS_BLOCK_IDS' => 9, 'NWS_BLOCK_VERSIONS' => 10, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'template' => 2, 'class_key' => 3, 'created_at' => 4, 'updated_at' => 5, 'version' => 6, 'version_created_at' => 7, 'version_created_by' => 8, 'nws_block_ids' => 9, 'nws_block_versions' => 10, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) - ); - - /** - * 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 = ModelVersionPeer::getFieldNames($toType); - $key = isset(ModelVersionPeer::$fieldKeys[$fromType][$name]) ? ModelVersionPeer::$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(ModelVersionPeer::$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, ModelVersionPeer::$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 ModelVersionPeer::$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. ModelVersionPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(ModelVersionPeer::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(ModelVersionPeer::ID); - $criteria->addSelectColumn(ModelVersionPeer::NAME); - $criteria->addSelectColumn(ModelVersionPeer::TEMPLATE); - $criteria->addSelectColumn(ModelVersionPeer::CLASS_KEY); - $criteria->addSelectColumn(ModelVersionPeer::CREATED_AT); - $criteria->addSelectColumn(ModelVersionPeer::UPDATED_AT); - $criteria->addSelectColumn(ModelVersionPeer::VERSION); - $criteria->addSelectColumn(ModelVersionPeer::VERSION_CREATED_AT); - $criteria->addSelectColumn(ModelVersionPeer::VERSION_CREATED_BY); - $criteria->addSelectColumn(ModelVersionPeer::NWS_BLOCK_IDS); - $criteria->addSelectColumn(ModelVersionPeer::NWS_BLOCK_VERSIONS); - } else { - $criteria->addSelectColumn($alias . '.id'); - $criteria->addSelectColumn($alias . '.name'); - $criteria->addSelectColumn($alias . '.template'); - $criteria->addSelectColumn($alias . '.class_key'); - $criteria->addSelectColumn($alias . '.created_at'); - $criteria->addSelectColumn($alias . '.updated_at'); - $criteria->addSelectColumn($alias . '.version'); - $criteria->addSelectColumn($alias . '.version_created_at'); - $criteria->addSelectColumn($alias . '.version_created_by'); - $criteria->addSelectColumn($alias . '.nws_block_ids'); - $criteria->addSelectColumn($alias . '.nws_block_versions'); - } - } - - /** - * 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(ModelVersionPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ModelVersionPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(ModelVersionPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(ModelVersionPeer::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 ModelVersion - * @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 = ModelVersionPeer::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 ModelVersionPeer::populateObjects(ModelVersionPeer::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 directly (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(ModelVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - ModelVersionPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(ModelVersionPeer::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 ModelVersion $obj A ModelVersion 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 = serialize(array((string) $obj->getId(), (string) $obj->getVersion())); - } // if key === null - ModelVersionPeer::$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 ModelVersion 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 ModelVersion) { - $key = serialize(array((string) $value->getId(), (string) $value->getVersion())); - } elseif (is_array($value) && count($value) === 2) { - // assume we've been passed a primary key - $key = serialize(array((string) $value[0], (string) $value[1])); - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ModelVersion object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(ModelVersionPeer::$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 ModelVersion 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(ModelVersionPeer::$instances[$key])) { - return ModelVersionPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool($and_clear_all_references = false) - { - if ($and_clear_all_references) { - foreach (ModelVersionPeer::$instances as $instance) { - $instance->clearAllReferences(true); - } - } - ModelVersionPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to nws_model_version - * 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 && $row[$startcol + 6] === null) { - return null; - } - - return serialize(array((string) $row[$startcol], (string) $row[$startcol + 6])); - } - - /** - * 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 array((int) $row[$startcol], (int) $row[$startcol + 6]); - } - - /** - * 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(); - - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = ModelVersionPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = ModelVersionPeer::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 { - // class must be set each time from the record row - $cls = ModelVersionPeer::getOMClass($row, 0); - $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - ModelVersionPeer::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 (ModelVersion object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = ModelVersionPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = ModelVersionPeer::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 + ModelVersionPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = ModelVersionPeer::getOMClass($row, $startcol); - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - ModelVersionPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Model 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 doCountJoinModel(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(ModelVersionPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ModelVersionPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ModelVersionPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ModelVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ModelVersionPeer::ID, ModelPeer::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 ModelVersion objects pre-filled with their Model 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 ModelVersion objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinModel(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(ModelVersionPeer::DATABASE_NAME); - } - - ModelVersionPeer::addSelectColumns($criteria); - $startcol = ModelVersionPeer::NUM_HYDRATE_COLUMNS; - ModelPeer::addSelectColumns($criteria); - - $criteria->addJoin(ModelVersionPeer::ID, ModelPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ModelVersionPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ModelVersionPeer::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 { - - $omClass = ModelVersionPeer::getOMClass($row, 0); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ModelVersionPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = ModelPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = ModelPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $omClass = ModelPeer::getOMClass($row, $startcol); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - ModelPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (ModelVersion) to $obj2 (Model) - $obj2->addModelVersion($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(ModelVersionPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ModelVersionPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ModelVersionPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ModelVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ModelVersionPeer::ID, ModelPeer::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 ModelVersion 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 ModelVersion 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(ModelVersionPeer::DATABASE_NAME); - } - - ModelVersionPeer::addSelectColumns($criteria); - $startcol2 = ModelVersionPeer::NUM_HYDRATE_COLUMNS; - - ModelPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + ModelPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(ModelVersionPeer::ID, ModelPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ModelVersionPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ModelVersionPeer::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 { - $omClass = ModelVersionPeer::getOMClass($row, 0); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ModelVersionPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Model rows - - $key2 = ModelPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = ModelPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $omClass = ModelPeer::getOMClass($row, $startcol2); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - ModelPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (ModelVersion) to the collection in $obj2 (Model) - $obj2->addModelVersion($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(ModelVersionPeer::DATABASE_NAME)->getTable(ModelVersionPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseModelVersionPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseModelVersionPeer::TABLE_NAME)) { - $dbMap->addTableObject(new \Trinity\Bundle\NewsletterBundle\Model\map\ModelVersionTableMap()); - } - } - - /** - * The returned Class will contain objects of the default type or - * objects that inherit from the default. - * - * @param array $row PropelPDO result row. - * @param int $colnum Column to examine for OM class information (first is 0). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getOMClass($row = 0, $colnum = 0) - { - try { - - $omClass = $row[$colnum + 3]; - $omClass = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - } catch (Exception $e) { - throw new PropelException('Unable to get OM class.', $e); - } - - - $event = new DetectOMClassEvent($omClass); - EventDispatcherProxy::trigger('om.detect', $event); - if($event->isDetected()){ - return $event->getDetectedClass(); - } - - return $omClass; - } - - /** - * Performs an INSERT on the database, given a ModelVersion or Criteria object. - * - * @param mixed $values Criteria or ModelVersion 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(ModelVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from ModelVersion object - } - - - // Set the correct dbName - $criteria->setDbName(ModelVersionPeer::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 (Exception $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a ModelVersion or Criteria object. - * - * @param mixed $values Criteria or ModelVersion 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(ModelVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(ModelVersionPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(ModelVersionPeer::ID); - $value = $criteria->remove(ModelVersionPeer::ID); - if ($value) { - $selectCriteria->add(ModelVersionPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(ModelVersionPeer::TABLE_NAME); - } - - $comparison = $criteria->getComparison(ModelVersionPeer::VERSION); - $value = $criteria->remove(ModelVersionPeer::VERSION); - if ($value) { - $selectCriteria->add(ModelVersionPeer::VERSION, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(ModelVersionPeer::TABLE_NAME); - } - - } else { // $values is ModelVersion object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(ModelVersionPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the nws_model_version 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(ModelVersionPeer::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(ModelVersionPeer::TABLE_NAME, $con, ModelVersionPeer::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). - ModelVersionPeer::clearInstancePool(); - ModelVersionPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a ModelVersion or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or ModelVersion 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(ModelVersionPeer::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. - ModelVersionPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof ModelVersion) { // it's a model object - // invalidate the cache for this single object - ModelVersionPeer::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(ModelVersionPeer::DATABASE_NAME); - // primary key is composite; we therefore, expect - // the primary key passed to be an array of pkey values - if (count($values) == count($values, COUNT_RECURSIVE)) { - // array is not multi-dimensional - $values = array($values); - } - foreach ($values as $value) { - $criterion = $criteria->getNewCriterion(ModelVersionPeer::ID, $value[0]); - $criterion->addAnd($criteria->getNewCriterion(ModelVersionPeer::VERSION, $value[1])); - $criteria->addOr($criterion); - // we can invalidate the cache for this single PK - ModelVersionPeer::removeInstanceFromPool($value); - } - } - - // Set the correct dbName - $criteria->setDbName(ModelVersionPeer::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); - ModelVersionPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given ModelVersion 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 ModelVersion $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(ModelVersionPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(ModelVersionPeer::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(ModelVersionPeer::DATABASE_NAME, ModelVersionPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve object using using composite pkey values. - * @param int $id - * @param int $version - * @param PropelPDO $con - * @return ModelVersion - */ - public static function retrieveByPK($id, $version, PropelPDO $con = null) { - $_instancePoolKey = serialize(array((string) $id, (string) $version)); - if (null !== ($obj = ModelVersionPeer::getInstanceFromPool($_instancePoolKey))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(ModelVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $criteria = new Criteria(ModelVersionPeer::DATABASE_NAME); - $criteria->add(ModelVersionPeer::ID, $id); - $criteria->add(ModelVersionPeer::VERSION, $version); - $v = ModelVersionPeer::doSelect($criteria, $con); - - return !empty($v) ? $v[0] : null; - } -} // BaseModelVersionPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseModelVersionPeer::buildTableMap(); - -EventDispatcherProxy::trigger(array('construct','peer.construct'), new PeerEvent('Trinity\Bundle\NewsletterBundle\Model\om\BaseModelVersionPeer')); diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelVersionQuery.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelVersionQuery.php deleted file mode 100644 index c117181..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseModelVersionQuery.php +++ /dev/null @@ -1,941 +0,0 @@ -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(array(12, 34), $con); - * - * - * @param array $key Primary key to use for the query - A Primary key composition: [$id, $version] - * @param PropelPDO $con an optional connection object - * - * @return ModelVersion|ModelVersion[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = ModelVersionPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) { - // the object is already in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(ModelVersionPeer::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 ModelVersion A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `id`, `name`, `template`, `class_key`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by`, `nws_block_ids`, `nws_block_versions` FROM `nws_model_version` WHERE `id` = :p0 AND `version` = :p1'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); - $stmt->bindValue(':p1', $key[1], 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)) { - $cls = ModelVersionPeer::getOMClass($row, 0); - $obj = new $cls(); - $obj->hydrate($row); - ModelVersionPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); - } - $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 ModelVersion|ModelVersion[]|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(array(12, 56), array(832, 123), array(123, 456)), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|ModelVersion[]|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 ModelVersionQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - $this->addUsingAlias(ModelVersionPeer::ID, $key[0], Criteria::EQUAL); - $this->addUsingAlias(ModelVersionPeer::VERSION, $key[1], Criteria::EQUAL); - - return $this; - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return ModelVersionQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - if (empty($keys)) { - return $this->add(null, '1<>1', Criteria::CUSTOM); - } - foreach ($keys as $key) { - $cton0 = $this->getNewCriterion(ModelVersionPeer::ID, $key[0], Criteria::EQUAL); - $cton1 = $this->getNewCriterion(ModelVersionPeer::VERSION, $key[1], Criteria::EQUAL); - $cton0->addAnd($cton1); - $this->addOr($cton0); - } - - return $this; - } - - /** - * 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 - * $query->filterById(array('max' => 12)); // WHERE id <= 12 - * - * - * @see filterByModel() - * - * @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 ModelVersionQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id)) { - $useMinMax = false; - if (isset($id['min'])) { - $this->addUsingAlias(ModelVersionPeer::ID, $id['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($id['max'])) { - $this->addUsingAlias(ModelVersionPeer::ID, $id['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModelVersionPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the name column - * - * Example usage: - * - * $query->filterByName('fooValue'); // WHERE name = 'fooValue' - * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' - * - * - * @param string $name 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 ModelVersionQuery The current query, for fluid interface - */ - public function filterByName($name = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($name)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $name)) { - $name = str_replace('*', '%', $name); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModelVersionPeer::NAME, $name, $comparison); - } - - /** - * Filter the query on the template column - * - * Example usage: - * - * $query->filterByTemplate('fooValue'); // WHERE template = 'fooValue' - * $query->filterByTemplate('%fooValue%'); // WHERE template LIKE '%fooValue%' - * - * - * @param string $template 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 ModelVersionQuery The current query, for fluid interface - */ - public function filterByTemplate($template = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($template)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $template)) { - $template = str_replace('*', '%', $template); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModelVersionPeer::TEMPLATE, $template, $comparison); - } - - /** - * Filter the query on the class_key column - * - * Example usage: - * - * $query->filterByClassKey('fooValue'); // WHERE class_key = 'fooValue' - * $query->filterByClassKey('%fooValue%'); // WHERE class_key LIKE '%fooValue%' - * - * - * @param string $classKey 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 ModelVersionQuery The current query, for fluid interface - */ - public function filterByClassKey($classKey = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($classKey)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $classKey)) { - $classKey = str_replace('*', '%', $classKey); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModelVersionPeer::CLASS_KEY, $classKey, $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 ModelVersionQuery 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(ModelVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(ModelVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModelVersionPeer::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 ModelVersionQuery 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(ModelVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(ModelVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModelVersionPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query on the version column - * - * Example usage: - * - * $query->filterByVersion(1234); // WHERE version = 1234 - * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34) - * $query->filterByVersion(array('min' => 12)); // WHERE version >= 12 - * $query->filterByVersion(array('max' => 12)); // WHERE version <= 12 - * - * - * @param mixed $version 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 ModelVersionQuery The current query, for fluid interface - */ - public function filterByVersion($version = null, $comparison = null) - { - if (is_array($version)) { - $useMinMax = false; - if (isset($version['min'])) { - $this->addUsingAlias(ModelVersionPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($version['max'])) { - $this->addUsingAlias(ModelVersionPeer::VERSION, $version['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModelVersionPeer::VERSION, $version, $comparison); - } - - /** - * Filter the query on the version_created_at column - * - * Example usage: - * - * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14' - * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14' - * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at < '2011-03-13' - * - * - * @param mixed $versionCreatedAt 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 ModelVersionQuery The current query, for fluid interface - */ - public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null) - { - if (is_array($versionCreatedAt)) { - $useMinMax = false; - if (isset($versionCreatedAt['min'])) { - $this->addUsingAlias(ModelVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($versionCreatedAt['max'])) { - $this->addUsingAlias(ModelVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ModelVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison); - } - - /** - * Filter the query on the version_created_by column - * - * Example usage: - * - * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue' - * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%' - * - * - * @param string $versionCreatedBy 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 ModelVersionQuery The current query, for fluid interface - */ - public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($versionCreatedBy)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) { - $versionCreatedBy = str_replace('*', '%', $versionCreatedBy); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ModelVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison); - } - - /** - * Filter the query on the nws_block_ids column - * - * @param array $nwsBlockIds The values to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModelVersionQuery The current query, for fluid interface - */ - public function filterByNwsBlockIds($nwsBlockIds = null, $comparison = null) - { - $key = $this->getAliasedColName(ModelVersionPeer::NWS_BLOCK_IDS); - if (null === $comparison || $comparison == Criteria::CONTAINS_ALL) { - foreach ($nwsBlockIds as $value) { - $value = '%| ' . $value . ' |%'; - if ($this->containsKey($key)) { - $this->addAnd($key, $value, Criteria::LIKE); - } else { - $this->add($key, $value, Criteria::LIKE); - } - } - - return $this; - } elseif ($comparison == Criteria::CONTAINS_SOME) { - foreach ($nwsBlockIds as $value) { - $value = '%| ' . $value . ' |%'; - if ($this->containsKey($key)) { - $this->addOr($key, $value, Criteria::LIKE); - } else { - $this->add($key, $value, Criteria::LIKE); - } - } - - return $this; - } elseif ($comparison == Criteria::CONTAINS_NONE) { - foreach ($nwsBlockIds as $value) { - $value = '%| ' . $value . ' |%'; - if ($this->containsKey($key)) { - $this->addAnd($key, $value, Criteria::NOT_LIKE); - } else { - $this->add($key, $value, Criteria::NOT_LIKE); - } - } - $this->addOr($key, null, Criteria::ISNULL); - - return $this; - } - - return $this->addUsingAlias(ModelVersionPeer::NWS_BLOCK_IDS, $nwsBlockIds, $comparison); - } - - /** - * Filter the query on the nws_block_ids column - * @param mixed $nwsBlockIds The value to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::CONTAINS_ALL - * - * @return ModelVersionQuery The current query, for fluid interface - */ - public function filterByNwsBlockId($nwsBlockIds = null, $comparison = null) - { - if (null === $comparison || $comparison == Criteria::CONTAINS_ALL) { - if (is_scalar($nwsBlockIds)) { - $nwsBlockIds = '%| ' . $nwsBlockIds . ' |%'; - $comparison = Criteria::LIKE; - } - } elseif ($comparison == Criteria::CONTAINS_NONE) { - $nwsBlockIds = '%| ' . $nwsBlockIds . ' |%'; - $comparison = Criteria::NOT_LIKE; - $key = $this->getAliasedColName(ModelVersionPeer::NWS_BLOCK_IDS); - if ($this->containsKey($key)) { - $this->addAnd($key, $nwsBlockIds, $comparison); - } else { - $this->addAnd($key, $nwsBlockIds, $comparison); - } - $this->addOr($key, null, Criteria::ISNULL); - - return $this; - } - - return $this->addUsingAlias(ModelVersionPeer::NWS_BLOCK_IDS, $nwsBlockIds, $comparison); - } - - /** - * Filter the query on the nws_block_versions column - * - * @param array $nwsBlockVersions The values to use as filter. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModelVersionQuery The current query, for fluid interface - */ - public function filterByNwsBlockVersions($nwsBlockVersions = null, $comparison = null) - { - $key = $this->getAliasedColName(ModelVersionPeer::NWS_BLOCK_VERSIONS); - if (null === $comparison || $comparison == Criteria::CONTAINS_ALL) { - foreach ($nwsBlockVersions as $value) { - $value = '%| ' . $value . ' |%'; - if ($this->containsKey($key)) { - $this->addAnd($key, $value, Criteria::LIKE); - } else { - $this->add($key, $value, Criteria::LIKE); - } - } - - return $this; - } elseif ($comparison == Criteria::CONTAINS_SOME) { - foreach ($nwsBlockVersions as $value) { - $value = '%| ' . $value . ' |%'; - if ($this->containsKey($key)) { - $this->addOr($key, $value, Criteria::LIKE); - } else { - $this->add($key, $value, Criteria::LIKE); - } - } - - return $this; - } elseif ($comparison == Criteria::CONTAINS_NONE) { - foreach ($nwsBlockVersions as $value) { - $value = '%| ' . $value . ' |%'; - if ($this->containsKey($key)) { - $this->addAnd($key, $value, Criteria::NOT_LIKE); - } else { - $this->add($key, $value, Criteria::NOT_LIKE); - } - } - $this->addOr($key, null, Criteria::ISNULL); - - return $this; - } - - return $this->addUsingAlias(ModelVersionPeer::NWS_BLOCK_VERSIONS, $nwsBlockVersions, $comparison); - } - - /** - * Filter the query on the nws_block_versions column - * @param mixed $nwsBlockVersions The value to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::CONTAINS_ALL - * - * @return ModelVersionQuery The current query, for fluid interface - */ - public function filterByNwsBlockVersion($nwsBlockVersions = null, $comparison = null) - { - if (null === $comparison || $comparison == Criteria::CONTAINS_ALL) { - if (is_scalar($nwsBlockVersions)) { - $nwsBlockVersions = '%| ' . $nwsBlockVersions . ' |%'; - $comparison = Criteria::LIKE; - } - } elseif ($comparison == Criteria::CONTAINS_NONE) { - $nwsBlockVersions = '%| ' . $nwsBlockVersions . ' |%'; - $comparison = Criteria::NOT_LIKE; - $key = $this->getAliasedColName(ModelVersionPeer::NWS_BLOCK_VERSIONS); - if ($this->containsKey($key)) { - $this->addAnd($key, $nwsBlockVersions, $comparison); - } else { - $this->addAnd($key, $nwsBlockVersions, $comparison); - } - $this->addOr($key, null, Criteria::ISNULL); - - return $this; - } - - return $this->addUsingAlias(ModelVersionPeer::NWS_BLOCK_VERSIONS, $nwsBlockVersions, $comparison); - } - - /** - * Filter the query by a related Model object - * - * @param Model|PropelObjectCollection $model The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ModelVersionQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByModel($model, $comparison = null) - { - if ($model instanceof Model) { - return $this - ->addUsingAlias(ModelVersionPeer::ID, $model->getId(), $comparison); - } elseif ($model instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(ModelVersionPeer::ID, $model->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByModel() only accepts arguments of type Model or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Model relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ModelVersionQuery The current query, for fluid interface - */ - public function joinModel($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Model'); - - // 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, 'Model'); - } - - return $this; - } - - /** - * Use the Model relation Model 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 \Trinity\Bundle\NewsletterBundle\Model\ModelQuery A secondary query class using the current class as primary query - */ - public function useModelQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinModel($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Model', '\Trinity\Bundle\NewsletterBundle\Model\ModelQuery'); - } - - /** - * Exclude object from result - * - * @param ModelVersion $modelVersion Object to remove from the list of results - * - * @return ModelVersionQuery The current query, for fluid interface - */ - public function prune($modelVersion = null) - { - if ($modelVersion) { - $this->addCond('pruneCond0', $this->getAliasedColName(ModelVersionPeer::ID), $modelVersion->getId(), Criteria::NOT_EQUAL); - $this->addCond('pruneCond1', $this->getAliasedColName(ModelVersionPeer::VERSION), $modelVersion->getVersion(), Criteria::NOT_EQUAL); - $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); - } - - return $this; - } - - /** - * Code to execute before every SELECT statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreSelect(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger('query.select.pre', new QueryEvent($this)); - - return $this->preSelect($con); - } - - /** - * Code to execute before every DELETE statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreDelete(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','query.delete.pre'), new QueryEvent($this)); - - return $this->preDelete($con); - } - - /** - * Code to execute after every DELETE statement - * - * @param int $affectedRows the number of deleted rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostDelete($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.post','query.delete.post'), new QueryEvent($this)); - - return $this->postDelete($affectedRows, $con); - } - - /** - * Code to execute before every UPDATE statement - * - * @param array $values The associative array of columns and values for the update - * @param PropelPDO $con The connection object used by the query - * @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), otherwise it is a series of save() calls on all the found objects - */ - protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false) - { - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'query.update.pre'), new QueryEvent($this)); - - return $this->preUpdate($values, $con, $forceIndividualSaves); - } - - /** - * Code to execute after every UPDATE statement - * - * @param int $affectedRows the number of updated rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostUpdate($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'query.update.post'), new QueryEvent($this)); - - return $this->postUpdate($affectedRows, $con); - } - - // extend behavior - public function setFormatter($formatter) - { - if (is_string($formatter) && $formatter === \ModelCriteria::FORMAT_ON_DEMAND) { - $formatter = '\Glorpen\Propel\PropelBundle\Formatter\PropelOnDemandFormatter'; - } - - return parent::setFormatter($formatter); - } -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletter.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletter.php deleted file mode 100644 index af20822..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletter.php +++ /dev/null @@ -1,2058 +0,0 @@ -id; - } - - public function __construct(){ - parent::__construct(); - EventDispatcherProxy::trigger(array('construct','model.construct'), new ModelEvent($this)); - } - - /** - * Get the [name] column value. - * - * @return string - */ - public function getName() - { - - return $this->name; - } - - /** - * Get the [sender_name] column value. - * - * @return string - */ - public function getSenderName() - { - - return $this->sender_name; - } - - /** - * Get the [sender_email] column value. - * - * @return string - */ - public function getSenderEmail() - { - - return $this->sender_email; - } - - /** - * Get the [model_id] column value. - * - * @return int - */ - public function getModelId() - { - - return $this->model_id; - } - - /** - * Get the [email_listing] column value. - * - * @return string - */ - public function getEmailListing() - { - - return $this->email_listing; - } - - /** - * Get the [optionally formatted] temporal [sent_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 getSentAt($format = null) - { - if ($this->sent_at === null) { - return null; - } - - if ($this->sent_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; - } - - try { - $dt = new DateTime($this->sent_at); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->sent_at, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is true, we return a DateTime object. - return $dt; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * 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 = null) - { - 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; - } - - 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; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - 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 = null) - { - 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; - } - - 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; - } - - if (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } - - return $dt->format($format); - - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return Newsletter The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = NewsletterPeer::ID; - } - - - return $this; - } // setId() - - /** - * Set the value of [name] column. - * - * @param string $v new value - * @return Newsletter The current object (for fluent API support) - */ - public function setName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->name !== $v) { - $this->name = $v; - $this->modifiedColumns[] = NewsletterPeer::NAME; - } - - - return $this; - } // setName() - - /** - * Set the value of [sender_name] column. - * - * @param string $v new value - * @return Newsletter The current object (for fluent API support) - */ - public function setSenderName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->sender_name !== $v) { - $this->sender_name = $v; - $this->modifiedColumns[] = NewsletterPeer::SENDER_NAME; - } - - - return $this; - } // setSenderName() - - /** - * Set the value of [sender_email] column. - * - * @param string $v new value - * @return Newsletter The current object (for fluent API support) - */ - public function setSenderEmail($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->sender_email !== $v) { - $this->sender_email = $v; - $this->modifiedColumns[] = NewsletterPeer::SENDER_EMAIL; - } - - - return $this; - } // setSenderEmail() - - /** - * Set the value of [model_id] column. - * - * @param int $v new value - * @return Newsletter The current object (for fluent API support) - */ - public function setModelId($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->model_id !== $v) { - $this->model_id = $v; - $this->modifiedColumns[] = NewsletterPeer::MODEL_ID; - } - - if ($this->aModel !== null && $this->aModel->getId() !== $v) { - $this->aModel = null; - } - - - return $this; - } // setModelId() - - /** - * Set the value of [email_listing] column. - * - * @param string $v new value - * @return Newsletter The current object (for fluent API support) - */ - public function setEmailListing($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->email_listing !== $v) { - $this->email_listing = $v; - $this->modifiedColumns[] = NewsletterPeer::EMAIL_LISTING; - } - - - return $this; - } // setEmailListing() - - /** - * Sets the value of [sent_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 Newsletter The current object (for fluent API support) - */ - public function setSentAt($v) - { - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); - if ($this->sent_at !== null || $dt !== null) { - $currentDateAsString = ($this->sent_at !== null && $tmpDt = new DateTime($this->sent_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->sent_at = $newDateAsString; - $this->modifiedColumns[] = NewsletterPeer::SENT_AT; - } - } // if either are not null - - - return $this; - } // setSentAt() - - /** - * 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 Newsletter 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[] = NewsletterPeer::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 Newsletter 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[] = NewsletterPeer::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 resultset 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->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->sender_name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->sender_email = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->model_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; - $this->email_listing = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->sent_at = ($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(); - } - $this->postHydrate($row, $startcol, $rehydrate); - - return $startcol + 9; // 9 = NewsletterPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating Newsletter 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->aModel !== null && $this->model_id !== $this->aModel->getId()) { - $this->aModel = 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(NewsletterPeer::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 = NewsletterPeer::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->aModel = null; - $this->collNewsletterRecipientss = null; - - $this->collGroups = 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(NewsletterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = NewsletterQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','model.delete.pre'), new ModelEvent($this)); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.post', 'model.delete.post'), new ModelEvent($this)); - $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(NewsletterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - // event behavior - EventDispatcherProxy::trigger('model.save.pre', new ModelEvent($this)); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // timestampable behavior - if (!$this->isColumnModified(NewsletterPeer::CREATED_AT)) { - $this->setCreatedAt(time()); - } - if (!$this->isColumnModified(NewsletterPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - // event behavior - EventDispatcherProxy::trigger('model.insert.pre', new ModelEvent($this)); - } else { - $ret = $ret && $this->preUpdate($con); - // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(NewsletterPeer::UPDATED_AT)) { - $this->setUpdatedAt(time()); - } - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'model.update.pre'), new ModelEvent($this)); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - // event behavior - EventDispatcherProxy::trigger('model.insert.post', new ModelEvent($this)); - } else { - $this->postUpdate($con); - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'model.update.post'), new ModelEvent($this)); - } - $this->postSave($con); - // event behavior - EventDispatcherProxy::trigger('model.save.post', new ModelEvent($this)); - NewsletterPeer::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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aModel !== null) { - if ($this->aModel->isModified() || $this->aModel->isNew()) { - $affectedRows += $this->aModel->save($con); - } - $this->setModel($this->aModel); - } - - if ($this->isNew() || $this->isModified()) { - // persist changes - if ($this->isNew()) { - $this->doInsert($con); - } else { - $this->doUpdate($con); - } - $affectedRows += 1; - $this->resetModified(); - } - - if ($this->groupsScheduledForDeletion !== null) { - if (!$this->groupsScheduledForDeletion->isEmpty()) { - $pks = array(); - $pk = $this->getPrimaryKey(); - foreach ($this->groupsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) { - $pks[] = array($pk, $remotePk); - } - NewsletterRecipientsQuery::create() - ->filterByPrimaryKeys($pks) - ->delete($con); - $this->groupsScheduledForDeletion = null; - } - - foreach ($this->getGroups() as $group) { - if ($group->isModified()) { - $group->save($con); - } - } - } elseif ($this->collGroups) { - foreach ($this->collGroups as $group) { - if ($group->isModified()) { - $group->save($con); - } - } - } - - if ($this->newsletterRecipientssScheduledForDeletion !== null) { - if (!$this->newsletterRecipientssScheduledForDeletion->isEmpty()) { - NewsletterRecipientsQuery::create() - ->filterByPrimaryKeys($this->newsletterRecipientssScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->newsletterRecipientssScheduledForDeletion = null; - } - } - - if ($this->collNewsletterRecipientss !== null) { - foreach ($this->collNewsletterRecipientss as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - - $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[] = NewsletterPeer::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . NewsletterPeer::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(NewsletterPeer::ID)) { - $modifiedColumns[':p' . $index++] = '`id`'; - } - if ($this->isColumnModified(NewsletterPeer::NAME)) { - $modifiedColumns[':p' . $index++] = '`name`'; - } - if ($this->isColumnModified(NewsletterPeer::SENDER_NAME)) { - $modifiedColumns[':p' . $index++] = '`sender_name`'; - } - if ($this->isColumnModified(NewsletterPeer::SENDER_EMAIL)) { - $modifiedColumns[':p' . $index++] = '`sender_email`'; - } - if ($this->isColumnModified(NewsletterPeer::MODEL_ID)) { - $modifiedColumns[':p' . $index++] = '`model_id`'; - } - if ($this->isColumnModified(NewsletterPeer::EMAIL_LISTING)) { - $modifiedColumns[':p' . $index++] = '`email_listing`'; - } - if ($this->isColumnModified(NewsletterPeer::SENT_AT)) { - $modifiedColumns[':p' . $index++] = '`sent_at`'; - } - if ($this->isColumnModified(NewsletterPeer::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = '`created_at`'; - } - if ($this->isColumnModified(NewsletterPeer::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = '`updated_at`'; - } - - $sql = sprintf( - 'INSERT INTO `nws_newsletter` (%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 '`name`': - $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); - break; - case '`sender_name`': - $stmt->bindValue($identifier, $this->sender_name, PDO::PARAM_STR); - break; - case '`sender_email`': - $stmt->bindValue($identifier, $this->sender_email, PDO::PARAM_STR); - break; - case '`model_id`': - $stmt->bindValue($identifier, $this->model_id, PDO::PARAM_INT); - break; - case '`email_listing`': - $stmt->bindValue($identifier, $this->email_listing, PDO::PARAM_STR); - break; - case '`sent_at`': - $stmt->bindValue($identifier, $this->sent_at, 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; - } - - $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 aggregated 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 objects 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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aModel !== null) { - if (!$this->aModel->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aModel->getValidationFailures()); - } - } - - - if (($retval = NewsletterPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - if ($this->collNewsletterRecipientss !== null) { - foreach ($this->collNewsletterRecipientss as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - - $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 = NewsletterPeer::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->getName(); - break; - case 2: - return $this->getSenderName(); - break; - case 3: - return $this->getSenderEmail(); - break; - case 4: - return $this->getModelId(); - break; - case 5: - return $this->getEmailListing(); - break; - case 6: - return $this->getSentAt(); - 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['Newsletter'][$this->getPrimaryKey()])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['Newsletter'][$this->getPrimaryKey()] = true; - $keys = NewsletterPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getName(), - $keys[2] => $this->getSenderName(), - $keys[3] => $this->getSenderEmail(), - $keys[4] => $this->getModelId(), - $keys[5] => $this->getEmailListing(), - $keys[6] => $this->getSentAt(), - $keys[7] => $this->getCreatedAt(), - $keys[8] => $this->getUpdatedAt(), - ); - $virtualColumns = $this->virtualColumns; - foreach ($virtualColumns as $key => $virtualColumn) { - $result[$key] = $virtualColumn; - } - - if ($includeForeignObjects) { - if (null !== $this->aModel) { - $result['Model'] = $this->aModel->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - if (null !== $this->collNewsletterRecipientss) { - $result['NewsletterRecipientss'] = $this->collNewsletterRecipientss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } - } - - 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 = NewsletterPeer::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->setName($value); - break; - case 2: - $this->setSenderName($value); - break; - case 3: - $this->setSenderEmail($value); - break; - case 4: - $this->setModelId($value); - break; - case 5: - $this->setEmailListing($value); - break; - case 6: - $this->setSentAt($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 = NewsletterPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setSenderName($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setSenderEmail($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setModelId($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setEmailListing($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setSentAt($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(NewsletterPeer::DATABASE_NAME); - - if ($this->isColumnModified(NewsletterPeer::ID)) $criteria->add(NewsletterPeer::ID, $this->id); - if ($this->isColumnModified(NewsletterPeer::NAME)) $criteria->add(NewsletterPeer::NAME, $this->name); - if ($this->isColumnModified(NewsletterPeer::SENDER_NAME)) $criteria->add(NewsletterPeer::SENDER_NAME, $this->sender_name); - if ($this->isColumnModified(NewsletterPeer::SENDER_EMAIL)) $criteria->add(NewsletterPeer::SENDER_EMAIL, $this->sender_email); - if ($this->isColumnModified(NewsletterPeer::MODEL_ID)) $criteria->add(NewsletterPeer::MODEL_ID, $this->model_id); - if ($this->isColumnModified(NewsletterPeer::EMAIL_LISTING)) $criteria->add(NewsletterPeer::EMAIL_LISTING, $this->email_listing); - if ($this->isColumnModified(NewsletterPeer::SENT_AT)) $criteria->add(NewsletterPeer::SENT_AT, $this->sent_at); - if ($this->isColumnModified(NewsletterPeer::CREATED_AT)) $criteria->add(NewsletterPeer::CREATED_AT, $this->created_at); - if ($this->isColumnModified(NewsletterPeer::UPDATED_AT)) $criteria->add(NewsletterPeer::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(NewsletterPeer::DATABASE_NAME); - $criteria->add(NewsletterPeer::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 Newsletter (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->setName($this->getName()); - $copyObj->setSenderName($this->getSenderName()); - $copyObj->setSenderEmail($this->getSenderEmail()); - $copyObj->setModelId($this->getModelId()); - $copyObj->setEmailListing($this->getEmailListing()); - $copyObj->setSentAt($this->getSentAt()); - $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; - - foreach ($this->getNewsletterRecipientss() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addNewsletterRecipients($relObj->copy($deepCopy)); - } - } - - //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 Newsletter 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 NewsletterPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new NewsletterPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Model object. - * - * @param Model $v - * @return Newsletter The current object (for fluent API support) - * @throws PropelException - */ - public function setModel(Model $v = null) - { - if ($v === null) { - $this->setModelId(NULL); - } else { - $this->setModelId($v->getId()); - } - - $this->aModel = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Model object, it will not be re-added. - if ($v !== null) { - $v->addNewsletter($this); - } - - - return $this; - } - - - /** - * Get the associated Model object - * - * @param PropelPDO $con Optional Connection object. - * @param $doQuery Executes a query to get the object if required - * @return Model The associated Model object. - * @throws PropelException - */ - public function getModel(PropelPDO $con = null, $doQuery = true) - { - if ($this->aModel === null && ($this->model_id !== null) && $doQuery) { - $this->aModel = ModelQuery::create()->findPk($this->model_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->aModel->addNewsletters($this); - */ - } - - return $this->aModel; - } - - - /** - * Initializes a collection based on the name of a relation. - * Avoids crafting an 'init[$relationName]s' method name - * that wouldn't work when StandardEnglishPluralizer is used. - * - * @param string $relationName The name of the relation to initialize - * @return void - */ - public function initRelation($relationName) - { - if ('NewsletterRecipients' == $relationName) { - $this->initNewsletterRecipientss(); - } - } - - /** - * Clears out the collNewsletterRecipientss collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return Newsletter The current object (for fluent API support) - * @see addNewsletterRecipientss() - */ - public function clearNewsletterRecipientss() - { - $this->collNewsletterRecipientss = null; // important to set this to null since that means it is uninitialized - $this->collNewsletterRecipientssPartial = null; - - return $this; - } - - /** - * reset is the collNewsletterRecipientss collection loaded partially - * - * @return void - */ - public function resetPartialNewsletterRecipientss($v = true) - { - $this->collNewsletterRecipientssPartial = $v; - } - - /** - * Initializes the collNewsletterRecipientss collection. - * - * By default this just sets the collNewsletterRecipientss collection to an empty array (like clearcollNewsletterRecipientss()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initNewsletterRecipientss($overrideExisting = true) - { - if (null !== $this->collNewsletterRecipientss && !$overrideExisting) { - return; - } - $this->collNewsletterRecipientss = new PropelObjectCollection(); - $this->collNewsletterRecipientss->setModel('NewsletterRecipients'); - } - - /** - * Gets an array of NewsletterRecipients objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this Newsletter is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelObjectCollection|NewsletterRecipients[] List of NewsletterRecipients objects - * @throws PropelException - */ - public function getNewsletterRecipientss($criteria = null, PropelPDO $con = null) - { - $partial = $this->collNewsletterRecipientssPartial && !$this->isNew(); - if (null === $this->collNewsletterRecipientss || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collNewsletterRecipientss) { - // return empty collection - $this->initNewsletterRecipientss(); - } else { - $collNewsletterRecipientss = NewsletterRecipientsQuery::create(null, $criteria) - ->filterByNewsletter($this) - ->find($con); - if (null !== $criteria) { - if (false !== $this->collNewsletterRecipientssPartial && count($collNewsletterRecipientss)) { - $this->initNewsletterRecipientss(false); - - foreach ($collNewsletterRecipientss as $obj) { - if (false == $this->collNewsletterRecipientss->contains($obj)) { - $this->collNewsletterRecipientss->append($obj); - } - } - - $this->collNewsletterRecipientssPartial = true; - } - - $collNewsletterRecipientss->getInternalIterator()->rewind(); - - return $collNewsletterRecipientss; - } - - if ($partial && $this->collNewsletterRecipientss) { - foreach ($this->collNewsletterRecipientss as $obj) { - if ($obj->isNew()) { - $collNewsletterRecipientss[] = $obj; - } - } - } - - $this->collNewsletterRecipientss = $collNewsletterRecipientss; - $this->collNewsletterRecipientssPartial = false; - } - } - - return $this->collNewsletterRecipientss; - } - - /** - * Sets a collection of NewsletterRecipients objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param PropelCollection $newsletterRecipientss A Propel collection. - * @param PropelPDO $con Optional connection object - * @return Newsletter The current object (for fluent API support) - */ - public function setNewsletterRecipientss(PropelCollection $newsletterRecipientss, PropelPDO $con = null) - { - $newsletterRecipientssToDelete = $this->getNewsletterRecipientss(new Criteria(), $con)->diff($newsletterRecipientss); - - - //since at least one column in the foreign key is at the same time a PK - //we can not just set a PK to NULL in the lines below. We have to store - //a backup of all values, so we are able to manipulate these items based on the onDelete value later. - $this->newsletterRecipientssScheduledForDeletion = clone $newsletterRecipientssToDelete; - - foreach ($newsletterRecipientssToDelete as $newsletterRecipientsRemoved) { - $newsletterRecipientsRemoved->setNewsletter(null); - } - - $this->collNewsletterRecipientss = null; - foreach ($newsletterRecipientss as $newsletterRecipients) { - $this->addNewsletterRecipients($newsletterRecipients); - } - - $this->collNewsletterRecipientss = $newsletterRecipientss; - $this->collNewsletterRecipientssPartial = false; - - return $this; - } - - /** - * Returns the number of related NewsletterRecipients objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related NewsletterRecipients objects. - * @throws PropelException - */ - public function countNewsletterRecipientss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - $partial = $this->collNewsletterRecipientssPartial && !$this->isNew(); - if (null === $this->collNewsletterRecipientss || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collNewsletterRecipientss) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getNewsletterRecipientss()); - } - $query = NewsletterRecipientsQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByNewsletter($this) - ->count($con); - } - - return count($this->collNewsletterRecipientss); - } - - /** - * Method called to associate a NewsletterRecipients object to this object - * through the NewsletterRecipients foreign key attribute. - * - * @param NewsletterRecipients $l NewsletterRecipients - * @return Newsletter The current object (for fluent API support) - */ - public function addNewsletterRecipients(NewsletterRecipients $l) - { - if ($this->collNewsletterRecipientss === null) { - $this->initNewsletterRecipientss(); - $this->collNewsletterRecipientssPartial = true; - } - - if (!in_array($l, $this->collNewsletterRecipientss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddNewsletterRecipients($l); - - if ($this->newsletterRecipientssScheduledForDeletion and $this->newsletterRecipientssScheduledForDeletion->contains($l)) { - $this->newsletterRecipientssScheduledForDeletion->remove($this->newsletterRecipientssScheduledForDeletion->search($l)); - } - } - - return $this; - } - - /** - * @param NewsletterRecipients $newsletterRecipients The newsletterRecipients object to add. - */ - protected function doAddNewsletterRecipients($newsletterRecipients) - { - $this->collNewsletterRecipientss[]= $newsletterRecipients; - $newsletterRecipients->setNewsletter($this); - } - - /** - * @param NewsletterRecipients $newsletterRecipients The newsletterRecipients object to remove. - * @return Newsletter The current object (for fluent API support) - */ - public function removeNewsletterRecipients($newsletterRecipients) - { - if ($this->getNewsletterRecipientss()->contains($newsletterRecipients)) { - $this->collNewsletterRecipientss->remove($this->collNewsletterRecipientss->search($newsletterRecipients)); - if (null === $this->newsletterRecipientssScheduledForDeletion) { - $this->newsletterRecipientssScheduledForDeletion = clone $this->collNewsletterRecipientss; - $this->newsletterRecipientssScheduledForDeletion->clear(); - } - $this->newsletterRecipientssScheduledForDeletion[]= clone $newsletterRecipients; - $newsletterRecipients->setNewsletter(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Newsletter is new, it will return - * an empty collection; or if this Newsletter has previously - * been saved, it will retrieve related NewsletterRecipientss from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Newsletter. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return PropelObjectCollection|NewsletterRecipients[] List of NewsletterRecipients objects - */ - public function getNewsletterRecipientssJoinGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $query = NewsletterRecipientsQuery::create(null, $criteria); - $query->joinWith('Group', $join_behavior); - - return $this->getNewsletterRecipientss($query, $con); - } - - /** - * Clears out the collGroups collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return Newsletter The current object (for fluent API support) - * @see addGroups() - */ - public function clearGroups() - { - $this->collGroups = null; // important to set this to null since that means it is uninitialized - $this->collGroupsPartial = null; - - return $this; - } - - /** - * Initializes the collGroups collection. - * - * By default this just sets the collGroups collection to an empty collection (like clearGroups()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @return void - */ - public function initGroups() - { - $this->collGroups = new PropelObjectCollection(); - $this->collGroups->setModel('Group'); - } - - /** - * Gets a collection of Group objects related by a many-to-many relationship - * to the current object by way of the nws_newsletter_recipients cross-reference table. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this Newsletter is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria Optional query object to filter the query - * @param PropelPDO $con Optional connection object - * - * @return PropelObjectCollection|Group[] List of Group objects - */ - public function getGroups($criteria = null, PropelPDO $con = null) - { - if (null === $this->collGroups || null !== $criteria) { - if ($this->isNew() && null === $this->collGroups) { - // return empty collection - $this->initGroups(); - } else { - $collGroups = GroupQuery::create(null, $criteria) - ->filterByNewsletter($this) - ->find($con); - if (null !== $criteria) { - return $collGroups; - } - $this->collGroups = $collGroups; - } - } - - return $this->collGroups; - } - - /** - * Sets a collection of Group objects related by a many-to-many relationship - * to the current object by way of the nws_newsletter_recipients cross-reference table. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param PropelCollection $groups A Propel collection. - * @param PropelPDO $con Optional connection object - * @return Newsletter The current object (for fluent API support) - */ - public function setGroups(PropelCollection $groups, PropelPDO $con = null) - { - $this->clearGroups(); - $currentGroups = $this->getGroups(null, $con); - - $this->groupsScheduledForDeletion = $currentGroups->diff($groups); - - foreach ($groups as $group) { - if (!$currentGroups->contains($group)) { - $this->doAddGroup($group); - } - } - - $this->collGroups = $groups; - - return $this; - } - - /** - * Gets the number of Group objects related by a many-to-many relationship - * to the current object by way of the nws_newsletter_recipients cross-reference table. - * - * @param Criteria $criteria Optional query object to filter the query - * @param boolean $distinct Set to true to force count distinct - * @param PropelPDO $con Optional connection object - * - * @return int the number of related Group objects - */ - public function countGroups($criteria = null, $distinct = false, PropelPDO $con = null) - { - if (null === $this->collGroups || null !== $criteria) { - if ($this->isNew() && null === $this->collGroups) { - return 0; - } else { - $query = GroupQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByNewsletter($this) - ->count($con); - } - } else { - return count($this->collGroups); - } - } - - /** - * Associate a Group object to this object - * through the nws_newsletter_recipients cross reference table. - * - * @param Group $group The NewsletterRecipients object to relate - * @return Newsletter The current object (for fluent API support) - */ - public function addGroup(Group $group) - { - if ($this->collGroups === null) { - $this->initGroups(); - } - - if (!$this->collGroups->contains($group)) { // only add it if the **same** object is not already associated - $this->doAddGroup($group); - $this->collGroups[] = $group; - - if ($this->groupsScheduledForDeletion and $this->groupsScheduledForDeletion->contains($group)) { - $this->groupsScheduledForDeletion->remove($this->groupsScheduledForDeletion->search($group)); - } - } - - return $this; - } - - /** - * @param Group $group The group object to add. - */ - protected function doAddGroup(Group $group) - { - // set the back reference to this object directly as using provided method either results - // in endless loop or in multiple relations - if (!$group->getNewsletters()->contains($this)) { $newsletterRecipients = new NewsletterRecipients(); - $newsletterRecipients->setGroup($group); - $this->addNewsletterRecipients($newsletterRecipients); - - $foreignCollection = $group->getNewsletters(); - $foreignCollection[] = $this; - } - } - - /** - * Remove a Group object to this object - * through the nws_newsletter_recipients cross reference table. - * - * @param Group $group The NewsletterRecipients object to relate - * @return Newsletter The current object (for fluent API support) - */ - public function removeGroup(Group $group) - { - if ($this->getGroups()->contains($group)) { - $this->collGroups->remove($this->collGroups->search($group)); - if (null === $this->groupsScheduledForDeletion) { - $this->groupsScheduledForDeletion = clone $this->collGroups; - $this->groupsScheduledForDeletion->clear(); - } - $this->groupsScheduledForDeletion[]= $group; - } - - return $this; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->name = null; - $this->sender_name = null; - $this->sender_email = null; - $this->model_id = null; - $this->email_listing = null; - $this->sent_at = null; - $this->created_at = null; - $this->updated_at = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->alreadyInClearAllReferencesDeep = 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-volume/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep && !$this->alreadyInClearAllReferencesDeep) { - $this->alreadyInClearAllReferencesDeep = true; - if ($this->collNewsletterRecipientss) { - foreach ($this->collNewsletterRecipientss as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collGroups) { - foreach ($this->collGroups as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->aModel instanceof Persistent) { - $this->aModel->clearAllReferences($deep); - } - - $this->alreadyInClearAllReferencesDeep = false; - } // if ($deep) - - if ($this->collNewsletterRecipientss instanceof PropelCollection) { - $this->collNewsletterRecipientss->clearIterator(); - } - $this->collNewsletterRecipientss = null; - if ($this->collGroups instanceof PropelCollection) { - $this->collGroups->clearIterator(); - } - $this->collGroups = null; - $this->aModel = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(NewsletterPeer::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 Newsletter The current object (for fluent API support) - */ - public function keepUpdateDateUnchanged() - { - $this->modifiedColumns[] = NewsletterPeer::UPDATED_AT; - - return $this; - } - - // event behavior - public function preCommit(\PropelPDO $con = null){} - public function preCommitSave(\PropelPDO $con = null){} - public function preCommitDelete(\PropelPDO $con = null){} - public function preCommitUpdate(\PropelPDO $con = null){} - public function preCommitInsert(\PropelPDO $con = null){} - public function preRollback(\PropelPDO $con = null){} - public function preRollbackSave(\PropelPDO $con = null){} - public function preRollbackDelete(\PropelPDO $con = null){} - public function preRollbackUpdate(\PropelPDO $con = null){} - public function preRollbackInsert(\PropelPDO $con = null){} - -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterPeer.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterPeer.php deleted file mode 100644 index b920c3f..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterPeer.php +++ /dev/null @@ -1,1053 +0,0 @@ - array ('Id', 'Name', 'SenderName', 'SenderEmail', 'ModelId', 'EmailListing', 'SentAt', 'CreatedAt', 'UpdatedAt', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'senderName', 'senderEmail', 'modelId', 'emailListing', 'sentAt', 'createdAt', 'updatedAt', ), - BasePeer::TYPE_COLNAME => array (NewsletterPeer::ID, NewsletterPeer::NAME, NewsletterPeer::SENDER_NAME, NewsletterPeer::SENDER_EMAIL, NewsletterPeer::MODEL_ID, NewsletterPeer::EMAIL_LISTING, NewsletterPeer::SENT_AT, NewsletterPeer::CREATED_AT, NewsletterPeer::UPDATED_AT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'SENDER_NAME', 'SENDER_EMAIL', 'MODEL_ID', 'EMAIL_LISTING', 'SENT_AT', 'CREATED_AT', 'UPDATED_AT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'sender_name', 'sender_email', 'model_id', 'email_listing', 'sent_at', '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. NewsletterPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'SenderName' => 2, 'SenderEmail' => 3, 'ModelId' => 4, 'EmailListing' => 5, 'SentAt' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'senderName' => 2, 'senderEmail' => 3, 'modelId' => 4, 'emailListing' => 5, 'sentAt' => 6, 'createdAt' => 7, 'updatedAt' => 8, ), - BasePeer::TYPE_COLNAME => array (NewsletterPeer::ID => 0, NewsletterPeer::NAME => 1, NewsletterPeer::SENDER_NAME => 2, NewsletterPeer::SENDER_EMAIL => 3, NewsletterPeer::MODEL_ID => 4, NewsletterPeer::EMAIL_LISTING => 5, NewsletterPeer::SENT_AT => 6, NewsletterPeer::CREATED_AT => 7, NewsletterPeer::UPDATED_AT => 8, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'SENDER_NAME' => 2, 'SENDER_EMAIL' => 3, 'MODEL_ID' => 4, 'EMAIL_LISTING' => 5, 'SENT_AT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'sender_name' => 2, 'sender_email' => 3, 'model_id' => 4, 'email_listing' => 5, 'sent_at' => 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 = NewsletterPeer::getFieldNames($toType); - $key = isset(NewsletterPeer::$fieldKeys[$fromType][$name]) ? NewsletterPeer::$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(NewsletterPeer::$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, NewsletterPeer::$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 NewsletterPeer::$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. NewsletterPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(NewsletterPeer::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(NewsletterPeer::ID); - $criteria->addSelectColumn(NewsletterPeer::NAME); - $criteria->addSelectColumn(NewsletterPeer::SENDER_NAME); - $criteria->addSelectColumn(NewsletterPeer::SENDER_EMAIL); - $criteria->addSelectColumn(NewsletterPeer::MODEL_ID); - $criteria->addSelectColumn(NewsletterPeer::EMAIL_LISTING); - $criteria->addSelectColumn(NewsletterPeer::SENT_AT); - $criteria->addSelectColumn(NewsletterPeer::CREATED_AT); - $criteria->addSelectColumn(NewsletterPeer::UPDATED_AT); - } else { - $criteria->addSelectColumn($alias . '.id'); - $criteria->addSelectColumn($alias . '.name'); - $criteria->addSelectColumn($alias . '.sender_name'); - $criteria->addSelectColumn($alias . '.sender_email'); - $criteria->addSelectColumn($alias . '.model_id'); - $criteria->addSelectColumn($alias . '.email_listing'); - $criteria->addSelectColumn($alias . '.sent_at'); - $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(NewsletterPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - NewsletterPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(NewsletterPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(NewsletterPeer::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 Newsletter - * @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 = NewsletterPeer::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 NewsletterPeer::populateObjects(NewsletterPeer::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 directly (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(NewsletterPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - NewsletterPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(NewsletterPeer::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 Newsletter $obj A Newsletter 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 - NewsletterPeer::$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 Newsletter 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 Newsletter) { - $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 Newsletter object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(NewsletterPeer::$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 Newsletter 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(NewsletterPeer::$instances[$key])) { - return NewsletterPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool($and_clear_all_references = false) - { - if ($and_clear_all_references) { - foreach (NewsletterPeer::$instances as $instance) { - $instance->clearAllReferences(true); - } - } - NewsletterPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to nws_newsletter - * 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 = NewsletterPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = NewsletterPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = NewsletterPeer::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; - NewsletterPeer::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 (Newsletter object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = NewsletterPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = NewsletterPeer::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 + NewsletterPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = NewsletterPeer::getOMClass($row, $startcol); - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - NewsletterPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Model 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 doCountJoinModel(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(NewsletterPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - NewsletterPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(NewsletterPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(NewsletterPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(NewsletterPeer::MODEL_ID, ModelPeer::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 Newsletter objects pre-filled with their Model 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 Newsletter objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinModel(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(NewsletterPeer::DATABASE_NAME); - } - - NewsletterPeer::addSelectColumns($criteria); - $startcol = NewsletterPeer::NUM_HYDRATE_COLUMNS; - ModelPeer::addSelectColumns($criteria); - - $criteria->addJoin(NewsletterPeer::MODEL_ID, ModelPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = NewsletterPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = NewsletterPeer::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 = NewsletterPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - NewsletterPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = ModelPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = ModelPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $omClass = ModelPeer::getOMClass($row, $startcol); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - ModelPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (Newsletter) to $obj2 (Model) - $obj2->addNewsletter($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(NewsletterPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - NewsletterPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(NewsletterPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(NewsletterPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(NewsletterPeer::MODEL_ID, ModelPeer::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 Newsletter 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 Newsletter 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(NewsletterPeer::DATABASE_NAME); - } - - NewsletterPeer::addSelectColumns($criteria); - $startcol2 = NewsletterPeer::NUM_HYDRATE_COLUMNS; - - ModelPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + ModelPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(NewsletterPeer::MODEL_ID, ModelPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = NewsletterPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = NewsletterPeer::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 = NewsletterPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - NewsletterPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Model rows - - $key2 = ModelPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = ModelPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $omClass = ModelPeer::getOMClass($row, $startcol2); - $cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - ModelPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (Newsletter) to the collection in $obj2 (Model) - $obj2->addNewsletter($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(NewsletterPeer::DATABASE_NAME)->getTable(NewsletterPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseNewsletterPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseNewsletterPeer::TABLE_NAME)) { - $dbMap->addTableObject(new \Trinity\Bundle\NewsletterBundle\Model\map\NewsletterTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass($row = 0, $colnum = 0) - { - - $event = new DetectOMClassEvent(NewsletterPeer::OM_CLASS); - EventDispatcherProxy::trigger('om.detect', $event); - if($event->isDetected()){ - return $event->getDetectedClass(); - } - - return NewsletterPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a Newsletter or Criteria object. - * - * @param mixed $values Criteria or Newsletter 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(NewsletterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Newsletter object - } - - if ($criteria->containsKey(NewsletterPeer::ID) && $criteria->keyContainsValue(NewsletterPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.NewsletterPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(NewsletterPeer::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 (Exception $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a Newsletter or Criteria object. - * - * @param mixed $values Criteria or Newsletter 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(NewsletterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(NewsletterPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(NewsletterPeer::ID); - $value = $criteria->remove(NewsletterPeer::ID); - if ($value) { - $selectCriteria->add(NewsletterPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(NewsletterPeer::TABLE_NAME); - } - - } else { // $values is Newsletter object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(NewsletterPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the nws_newsletter 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(NewsletterPeer::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(NewsletterPeer::TABLE_NAME, $con, NewsletterPeer::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). - NewsletterPeer::clearInstancePool(); - NewsletterPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a Newsletter or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Newsletter 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(NewsletterPeer::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. - NewsletterPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof Newsletter) { // it's a model object - // invalidate the cache for this single object - NewsletterPeer::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(NewsletterPeer::DATABASE_NAME); - $criteria->add(NewsletterPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - NewsletterPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(NewsletterPeer::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); - NewsletterPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given Newsletter 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 Newsletter $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(NewsletterPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(NewsletterPeer::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(NewsletterPeer::DATABASE_NAME, NewsletterPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return Newsletter - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = NewsletterPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(NewsletterPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(NewsletterPeer::DATABASE_NAME); - $criteria->add(NewsletterPeer::ID, $pk); - - $v = NewsletterPeer::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 Newsletter[] - * @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(NewsletterPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(NewsletterPeer::DATABASE_NAME); - $criteria->add(NewsletterPeer::ID, $pks, Criteria::IN); - $objs = NewsletterPeer::doSelect($criteria, $con); - } - - return $objs; - } - -} // BaseNewsletterPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseNewsletterPeer::buildTableMap(); - -EventDispatcherProxy::trigger(array('construct','peer.construct'), new PeerEvent('Trinity\Bundle\NewsletterBundle\Model\om\BaseNewsletterPeer')); diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterQuery.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterQuery.php deleted file mode 100644 index a197258..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterQuery.php +++ /dev/null @@ -1,931 +0,0 @@ -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 Newsletter|Newsletter[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = NewsletterPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is already in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(NewsletterPeer::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); - } - } - - /** - * Alias of findPk to use instance pooling - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con A connection object - * - * @return Newsletter A model object, or null if the key is not found - * @throws PropelException - */ - public function findOneById($key, $con = null) - { - return $this->findPk($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 Newsletter A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `id`, `name`, `sender_name`, `sender_email`, `model_id`, `email_listing`, `sent_at`, `created_at`, `updated_at` FROM `nws_newsletter` 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)) { - $cls = NewsletterPeer::getOMClass(); - $obj = new $cls; - $obj->hydrate($row); - NewsletterPeer::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 Newsletter|Newsletter[]|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|Newsletter[]|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 NewsletterQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(NewsletterPeer::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 NewsletterQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(NewsletterPeer::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 - * $query->filterById(array('max' => 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 NewsletterQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id)) { - $useMinMax = false; - if (isset($id['min'])) { - $this->addUsingAlias(NewsletterPeer::ID, $id['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($id['max'])) { - $this->addUsingAlias(NewsletterPeer::ID, $id['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(NewsletterPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the name column - * - * Example usage: - * - * $query->filterByName('fooValue'); // WHERE name = 'fooValue' - * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' - * - * - * @param string $name 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 NewsletterQuery The current query, for fluid interface - */ - public function filterByName($name = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($name)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $name)) { - $name = str_replace('*', '%', $name); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(NewsletterPeer::NAME, $name, $comparison); - } - - /** - * Filter the query on the sender_name column - * - * Example usage: - * - * $query->filterBySenderName('fooValue'); // WHERE sender_name = 'fooValue' - * $query->filterBySenderName('%fooValue%'); // WHERE sender_name LIKE '%fooValue%' - * - * - * @param string $senderName 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 NewsletterQuery The current query, for fluid interface - */ - public function filterBySenderName($senderName = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($senderName)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $senderName)) { - $senderName = str_replace('*', '%', $senderName); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(NewsletterPeer::SENDER_NAME, $senderName, $comparison); - } - - /** - * Filter the query on the sender_email column - * - * Example usage: - * - * $query->filterBySenderEmail('fooValue'); // WHERE sender_email = 'fooValue' - * $query->filterBySenderEmail('%fooValue%'); // WHERE sender_email LIKE '%fooValue%' - * - * - * @param string $senderEmail 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 NewsletterQuery The current query, for fluid interface - */ - public function filterBySenderEmail($senderEmail = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($senderEmail)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $senderEmail)) { - $senderEmail = str_replace('*', '%', $senderEmail); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(NewsletterPeer::SENDER_EMAIL, $senderEmail, $comparison); - } - - /** - * Filter the query on the model_id column - * - * Example usage: - * - * $query->filterByModelId(1234); // WHERE model_id = 1234 - * $query->filterByModelId(array(12, 34)); // WHERE model_id IN (12, 34) - * $query->filterByModelId(array('min' => 12)); // WHERE model_id >= 12 - * $query->filterByModelId(array('max' => 12)); // WHERE model_id <= 12 - * - * - * @see filterByModel() - * - * @param mixed $modelId 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 NewsletterQuery The current query, for fluid interface - */ - public function filterByModelId($modelId = null, $comparison = null) - { - if (is_array($modelId)) { - $useMinMax = false; - if (isset($modelId['min'])) { - $this->addUsingAlias(NewsletterPeer::MODEL_ID, $modelId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($modelId['max'])) { - $this->addUsingAlias(NewsletterPeer::MODEL_ID, $modelId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(NewsletterPeer::MODEL_ID, $modelId, $comparison); - } - - /** - * Filter the query on the email_listing column - * - * Example usage: - * - * $query->filterByEmailListing('fooValue'); // WHERE email_listing = 'fooValue' - * $query->filterByEmailListing('%fooValue%'); // WHERE email_listing LIKE '%fooValue%' - * - * - * @param string $emailListing 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 NewsletterQuery The current query, for fluid interface - */ - public function filterByEmailListing($emailListing = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($emailListing)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $emailListing)) { - $emailListing = str_replace('*', '%', $emailListing); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(NewsletterPeer::EMAIL_LISTING, $emailListing, $comparison); - } - - /** - * Filter the query on the sent_at column - * - * Example usage: - * - * $query->filterBySentAt('2011-03-14'); // WHERE sent_at = '2011-03-14' - * $query->filterBySentAt('now'); // WHERE sent_at = '2011-03-14' - * $query->filterBySentAt(array('max' => 'yesterday')); // WHERE sent_at < '2011-03-13' - * - * - * @param mixed $sentAt 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 NewsletterQuery The current query, for fluid interface - */ - public function filterBySentAt($sentAt = null, $comparison = null) - { - if (is_array($sentAt)) { - $useMinMax = false; - if (isset($sentAt['min'])) { - $this->addUsingAlias(NewsletterPeer::SENT_AT, $sentAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($sentAt['max'])) { - $this->addUsingAlias(NewsletterPeer::SENT_AT, $sentAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(NewsletterPeer::SENT_AT, $sentAt, $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 NewsletterQuery 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(NewsletterPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(NewsletterPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(NewsletterPeer::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 NewsletterQuery 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(NewsletterPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(NewsletterPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(NewsletterPeer::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related Model object - * - * @param Model|PropelObjectCollection $model The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return NewsletterQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByModel($model, $comparison = null) - { - if ($model instanceof Model) { - return $this - ->addUsingAlias(NewsletterPeer::MODEL_ID, $model->getId(), $comparison); - } elseif ($model instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(NewsletterPeer::MODEL_ID, $model->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByModel() only accepts arguments of type Model or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Model relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return NewsletterQuery The current query, for fluid interface - */ - public function joinModel($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Model'); - - // 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, 'Model'); - } - - return $this; - } - - /** - * Use the Model relation Model 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 \Trinity\Bundle\NewsletterBundle\Model\ModelQuery A secondary query class using the current class as primary query - */ - public function useModelQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinModel($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Model', '\Trinity\Bundle\NewsletterBundle\Model\ModelQuery'); - } - - /** - * Filter the query by a related NewsletterRecipients object - * - * @param NewsletterRecipients|PropelObjectCollection $newsletterRecipients the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return NewsletterQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByNewsletterRecipients($newsletterRecipients, $comparison = null) - { - if ($newsletterRecipients instanceof NewsletterRecipients) { - return $this - ->addUsingAlias(NewsletterPeer::ID, $newsletterRecipients->getNwsNewsletterId(), $comparison); - } elseif ($newsletterRecipients instanceof PropelObjectCollection) { - return $this - ->useNewsletterRecipientsQuery() - ->filterByPrimaryKeys($newsletterRecipients->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByNewsletterRecipients() only accepts arguments of type NewsletterRecipients or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the NewsletterRecipients relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return NewsletterQuery The current query, for fluid interface - */ - public function joinNewsletterRecipients($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('NewsletterRecipients'); - - // 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, 'NewsletterRecipients'); - } - - return $this; - } - - /** - * Use the NewsletterRecipients relation NewsletterRecipients 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 \Trinity\Bundle\NewsletterBundle\Model\NewsletterRecipientsQuery A secondary query class using the current class as primary query - */ - public function useNewsletterRecipientsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinNewsletterRecipients($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'NewsletterRecipients', '\Trinity\Bundle\NewsletterBundle\Model\NewsletterRecipientsQuery'); - } - - /** - * Filter the query by a related Group object - * using the nws_newsletter_recipients table as cross reference - * - * @param Group $group the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return NewsletterQuery The current query, for fluid interface - */ - public function filterByGroup($group, $comparison = Criteria::EQUAL) - { - return $this - ->useNewsletterRecipientsQuery() - ->filterByGroup($group, $comparison) - ->endUse(); - } - - /** - * Exclude object from result - * - * @param Newsletter $newsletter Object to remove from the list of results - * - * @return NewsletterQuery The current query, for fluid interface - */ - public function prune($newsletter = null) - { - if ($newsletter) { - $this->addUsingAlias(NewsletterPeer::ID, $newsletter->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - /** - * Code to execute before every SELECT statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreSelect(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger('query.select.pre', new QueryEvent($this)); - - return $this->preSelect($con); - } - - /** - * Code to execute before every DELETE statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreDelete(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','query.delete.pre'), new QueryEvent($this)); - - return $this->preDelete($con); - } - - /** - * Code to execute after every DELETE statement - * - * @param int $affectedRows the number of deleted rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostDelete($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.post','query.delete.post'), new QueryEvent($this)); - - return $this->postDelete($affectedRows, $con); - } - - /** - * Code to execute before every UPDATE statement - * - * @param array $values The associative array of columns and values for the update - * @param PropelPDO $con The connection object used by the query - * @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), otherwise it is a series of save() calls on all the found objects - */ - protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false) - { - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'query.update.pre'), new QueryEvent($this)); - - return $this->preUpdate($values, $con, $forceIndividualSaves); - } - - /** - * Code to execute after every UPDATE statement - * - * @param int $affectedRows the number of updated rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostUpdate($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'query.update.post'), new QueryEvent($this)); - - return $this->postUpdate($affectedRows, $con); - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return NewsletterQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(NewsletterPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return NewsletterQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(NewsletterPeer::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return NewsletterQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(NewsletterPeer::UPDATED_AT); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return NewsletterQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(NewsletterPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by create date desc - * - * @return NewsletterQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(NewsletterPeer::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return NewsletterQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(NewsletterPeer::CREATED_AT); - } - // extend behavior - public function setFormatter($formatter) - { - if (is_string($formatter) && $formatter === \ModelCriteria::FORMAT_ON_DEMAND) { - $formatter = '\Glorpen\Propel\PropelBundle\Formatter\PropelOnDemandFormatter'; - } - - return parent::setFormatter($formatter); - } -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterRecipients.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterRecipients.php deleted file mode 100644 index b138be9..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterRecipients.php +++ /dev/null @@ -1,1063 +0,0 @@ -nws_newsletter_id; - } - - public function __construct(){ - parent::__construct(); - EventDispatcherProxy::trigger(array('construct','model.construct'), new ModelEvent($this)); - } - - /** - * Get the [fos_group_id] column value. - * - * @return int - */ - public function getFosGroupId() - { - - return $this->fos_group_id; - } - - /** - * Set the value of [nws_newsletter_id] column. - * - * @param int $v new value - * @return NewsletterRecipients The current object (for fluent API support) - */ - public function setNwsNewsletterId($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->nws_newsletter_id !== $v) { - $this->nws_newsletter_id = $v; - $this->modifiedColumns[] = NewsletterRecipientsPeer::NWS_NEWSLETTER_ID; - } - - if ($this->aNewsletter !== null && $this->aNewsletter->getId() !== $v) { - $this->aNewsletter = null; - } - - - return $this; - } // setNwsNewsletterId() - - /** - * Set the value of [fos_group_id] column. - * - * @param int $v new value - * @return NewsletterRecipients The current object (for fluent API support) - */ - public function setFosGroupId($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->fos_group_id !== $v) { - $this->fos_group_id = $v; - $this->modifiedColumns[] = NewsletterRecipientsPeer::FOS_GROUP_ID; - } - - if ($this->aGroup !== null && $this->aGroup->getId() !== $v) { - $this->aGroup = null; - } - - - return $this; - } // setFosGroupId() - - /** - * 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 resultset 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->nws_newsletter_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->fos_group_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - $this->postHydrate($row, $startcol, $rehydrate); - - return $startcol + 2; // 2 = NewsletterRecipientsPeer::NUM_HYDRATE_COLUMNS. - - } catch (Exception $e) { - throw new PropelException("Error populating NewsletterRecipients 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->aNewsletter !== null && $this->nws_newsletter_id !== $this->aNewsletter->getId()) { - $this->aNewsletter = null; - } - if ($this->aGroup !== null && $this->fos_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(NewsletterRecipientsPeer::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 = NewsletterRecipientsPeer::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->aNewsletter = null; - $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(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $deleteQuery = NewsletterRecipientsQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()); - $ret = $this->preDelete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','model.delete.pre'), new ModelEvent($this)); - if ($ret) { - $deleteQuery->delete($con); - $this->postDelete($con); - // event behavior - EventDispatcherProxy::trigger(array('delete.post', 'model.delete.post'), new ModelEvent($this)); - $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(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - // event behavior - EventDispatcherProxy::trigger('model.save.pre', new ModelEvent($this)); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - // event behavior - EventDispatcherProxy::trigger('model.insert.pre', new ModelEvent($this)); - } else { - $ret = $ret && $this->preUpdate($con); - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'model.update.pre'), new ModelEvent($this)); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - // event behavior - EventDispatcherProxy::trigger('model.insert.post', new ModelEvent($this)); - } else { - $this->postUpdate($con); - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'model.update.post'), new ModelEvent($this)); - } - $this->postSave($con); - // event behavior - EventDispatcherProxy::trigger('model.save.post', new ModelEvent($this)); - NewsletterRecipientsPeer::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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aNewsletter !== null) { - if ($this->aNewsletter->isModified() || $this->aNewsletter->isNew()) { - $affectedRows += $this->aNewsletter->save($con); - } - $this->setNewsletter($this->aNewsletter); - } - - 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(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID)) { - $modifiedColumns[':p' . $index++] = '`nws_newsletter_id`'; - } - if ($this->isColumnModified(NewsletterRecipientsPeer::FOS_GROUP_ID)) { - $modifiedColumns[':p' . $index++] = '`fos_group_id`'; - } - - $sql = sprintf( - 'INSERT INTO `nws_newsletter_recipients` (%s) VALUES (%s)', - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case '`nws_newsletter_id`': - $stmt->bindValue($identifier, $this->nws_newsletter_id, PDO::PARAM_INT); - break; - case '`fos_group_id`': - $stmt->bindValue($identifier, $this->fos_group_id, PDO::PARAM_INT); - 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; - } - - $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 aggregated 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 objects 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 corresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aNewsletter !== null) { - if (!$this->aNewsletter->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aNewsletter->getValidationFailures()); - } - } - - if ($this->aGroup !== null) { - if (!$this->aGroup->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aGroup->getValidationFailures()); - } - } - - - if (($retval = NewsletterRecipientsPeer::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 = NewsletterRecipientsPeer::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->getNwsNewsletterId(); - break; - case 1: - return $this->getFosGroupId(); - 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['NewsletterRecipients'][serialize($this->getPrimaryKey())])) { - return '*RECURSION*'; - } - $alreadyDumpedObjects['NewsletterRecipients'][serialize($this->getPrimaryKey())] = true; - $keys = NewsletterRecipientsPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getNwsNewsletterId(), - $keys[1] => $this->getFosGroupId(), - ); - $virtualColumns = $this->virtualColumns; - foreach ($virtualColumns as $key => $virtualColumn) { - $result[$key] = $virtualColumn; - } - - if ($includeForeignObjects) { - if (null !== $this->aNewsletter) { - $result['Newsletter'] = $this->aNewsletter->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - 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 = NewsletterRecipientsPeer::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->setNwsNewsletterId($value); - break; - case 1: - $this->setFosGroupId($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 = NewsletterRecipientsPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setNwsNewsletterId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setFosGroupId($arr[$keys[1]]); - } - - /** - * 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(NewsletterRecipientsPeer::DATABASE_NAME); - - if ($this->isColumnModified(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID)) $criteria->add(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $this->nws_newsletter_id); - if ($this->isColumnModified(NewsletterRecipientsPeer::FOS_GROUP_ID)) $criteria->add(NewsletterRecipientsPeer::FOS_GROUP_ID, $this->fos_group_id); - - 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(NewsletterRecipientsPeer::DATABASE_NAME); - $criteria->add(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $this->nws_newsletter_id); - $criteria->add(NewsletterRecipientsPeer::FOS_GROUP_ID, $this->fos_group_id); - - return $criteria; - } - - /** - * Returns the composite primary key for this object. - * The array elements will be in same order as specified in XML. - * @return array - */ - public function getPrimaryKey() - { - $pks = array(); - $pks[0] = $this->getNwsNewsletterId(); - $pks[1] = $this->getFosGroupId(); - - return $pks; - } - - /** - * Set the [composite] primary key. - * - * @param array $keys The elements of the composite key (order must match the order in XML file). - * @return void - */ - public function setPrimaryKey($keys) - { - $this->setNwsNewsletterId($keys[0]); - $this->setFosGroupId($keys[1]); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - - return (null === $this->getNwsNewsletterId()) && (null === $this->getFosGroupId()); - } - - /** - * 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 NewsletterRecipients (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->setNwsNewsletterId($this->getNwsNewsletterId()); - $copyObj->setFosGroupId($this->getFosGroupId()); - - 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); - } - } - - /** - * 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 NewsletterRecipients 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 NewsletterRecipientsPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new NewsletterRecipientsPeer(); - } - - return self::$peer; - } - - /** - * Declares an association between this object and a Newsletter object. - * - * @param Newsletter $v - * @return NewsletterRecipients The current object (for fluent API support) - * @throws PropelException - */ - public function setNewsletter(Newsletter $v = null) - { - if ($v === null) { - $this->setNwsNewsletterId(NULL); - } else { - $this->setNwsNewsletterId($v->getId()); - } - - $this->aNewsletter = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the Newsletter object, it will not be re-added. - if ($v !== null) { - $v->addNewsletterRecipients($this); - } - - - return $this; - } - - - /** - * Get the associated Newsletter object - * - * @param PropelPDO $con Optional Connection object. - * @param $doQuery Executes a query to get the object if required - * @return Newsletter The associated Newsletter object. - * @throws PropelException - */ - public function getNewsletter(PropelPDO $con = null, $doQuery = true) - { - if ($this->aNewsletter === null && ($this->nws_newsletter_id !== null) && $doQuery) { - $this->aNewsletter = NewsletterQuery::create()->findPk($this->nws_newsletter_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->aNewsletter->addNewsletterRecipientss($this); - */ - } - - return $this->aNewsletter; - } - - /** - * Declares an association between this object and a Group object. - * - * @param Group $v - * @return NewsletterRecipients The current object (for fluent API support) - * @throws PropelException - */ - public function setGroup(Group $v = null) - { - if ($v === null) { - $this->setFosGroupId(NULL); - } else { - $this->setFosGroupId($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->addNewsletterRecipients($this); - } - - - return $this; - } - - - /** - * Get the associated Group object - * - * @param PropelPDO $con Optional Connection object. - * @param $doQuery Executes a query to get the object if required - * @return Group The associated Group object. - * @throws PropelException - */ - public function getGroup(PropelPDO $con = null, $doQuery = true) - { - if ($this->aGroup === null && ($this->fos_group_id !== null) && $doQuery) { - $this->aGroup = GroupQuery::create()->findPk($this->fos_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->addNewsletterRecipientss($this); - */ - } - - return $this->aGroup; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->nws_newsletter_id = null; - $this->fos_group_id = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->alreadyInClearAllReferencesDeep = 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-volume/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all referrer objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep && !$this->alreadyInClearAllReferencesDeep) { - $this->alreadyInClearAllReferencesDeep = true; - if ($this->aNewsletter instanceof Persistent) { - $this->aNewsletter->clearAllReferences($deep); - } - if ($this->aGroup instanceof Persistent) { - $this->aGroup->clearAllReferences($deep); - } - - $this->alreadyInClearAllReferencesDeep = false; - } // if ($deep) - - $this->aNewsletter = null; - $this->aGroup = null; - } - - /** - * return the string representation of this object - * - * @return string - */ - public function __toString() - { - return (string) $this->exportTo(NewsletterRecipientsPeer::DEFAULT_STRING_FORMAT); - } - - /** - * return true is the object is in saving state - * - * @return boolean - */ - public function isAlreadyInSave() - { - return $this->alreadyInSave; - } - - // event behavior - public function preCommit(\PropelPDO $con = null){} - public function preCommitSave(\PropelPDO $con = null){} - public function preCommitDelete(\PropelPDO $con = null){} - public function preCommitUpdate(\PropelPDO $con = null){} - public function preCommitInsert(\PropelPDO $con = null){} - public function preRollback(\PropelPDO $con = null){} - public function preRollbackSave(\PropelPDO $con = null){} - public function preRollbackDelete(\PropelPDO $con = null){} - public function preRollbackUpdate(\PropelPDO $con = null){} - public function preRollbackInsert(\PropelPDO $con = null){} - -} diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterRecipientsPeer.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterRecipientsPeer.php deleted file mode 100644 index 6bef74e..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterRecipientsPeer.php +++ /dev/null @@ -1,1392 +0,0 @@ - array ('NwsNewsletterId', 'FosGroupId', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('nwsNewsletterId', 'fosGroupId', ), - BasePeer::TYPE_COLNAME => array (NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, NewsletterRecipientsPeer::FOS_GROUP_ID, ), - BasePeer::TYPE_RAW_COLNAME => array ('NWS_NEWSLETTER_ID', 'FOS_GROUP_ID', ), - BasePeer::TYPE_FIELDNAME => array ('nws_newsletter_id', 'fos_group_id', ), - BasePeer::TYPE_NUM => array (0, 1, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. NewsletterRecipientsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('NwsNewsletterId' => 0, 'FosGroupId' => 1, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('nwsNewsletterId' => 0, 'fosGroupId' => 1, ), - BasePeer::TYPE_COLNAME => array (NewsletterRecipientsPeer::NWS_NEWSLETTER_ID => 0, NewsletterRecipientsPeer::FOS_GROUP_ID => 1, ), - BasePeer::TYPE_RAW_COLNAME => array ('NWS_NEWSLETTER_ID' => 0, 'FOS_GROUP_ID' => 1, ), - BasePeer::TYPE_FIELDNAME => array ('nws_newsletter_id' => 0, 'fos_group_id' => 1, ), - BasePeer::TYPE_NUM => array (0, 1, ) - ); - - /** - * 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 = NewsletterRecipientsPeer::getFieldNames($toType); - $key = isset(NewsletterRecipientsPeer::$fieldKeys[$fromType][$name]) ? NewsletterRecipientsPeer::$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(NewsletterRecipientsPeer::$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, NewsletterRecipientsPeer::$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 NewsletterRecipientsPeer::$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. NewsletterRecipientsPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(NewsletterRecipientsPeer::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(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID); - $criteria->addSelectColumn(NewsletterRecipientsPeer::FOS_GROUP_ID); - } else { - $criteria->addSelectColumn($alias . '.nws_newsletter_id'); - $criteria->addSelectColumn($alias . '.fos_group_id'); - } - } - - /** - * 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(NewsletterRecipientsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - NewsletterRecipientsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(NewsletterRecipientsPeer::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(NewsletterRecipientsPeer::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 NewsletterRecipients - * @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 = NewsletterRecipientsPeer::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 NewsletterRecipientsPeer::populateObjects(NewsletterRecipientsPeer::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 directly (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(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - NewsletterRecipientsPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(NewsletterRecipientsPeer::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 NewsletterRecipients $obj A NewsletterRecipients 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 = serialize(array((string) $obj->getNwsNewsletterId(), (string) $obj->getFosGroupId())); - } // if key === null - NewsletterRecipientsPeer::$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 NewsletterRecipients 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 NewsletterRecipients) { - $key = serialize(array((string) $value->getNwsNewsletterId(), (string) $value->getFosGroupId())); - } elseif (is_array($value) && count($value) === 2) { - // assume we've been passed a primary key - $key = serialize(array((string) $value[0], (string) $value[1])); - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or NewsletterRecipients object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(NewsletterRecipientsPeer::$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 NewsletterRecipients 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(NewsletterRecipientsPeer::$instances[$key])) { - return NewsletterRecipientsPeer::$instances[$key]; - } - } - - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool($and_clear_all_references = false) - { - if ($and_clear_all_references) { - foreach (NewsletterRecipientsPeer::$instances as $instance) { - $instance->clearAllReferences(true); - } - } - NewsletterRecipientsPeer::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to nws_newsletter_recipients - * 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 && $row[$startcol + 1] === null) { - return null; - } - - return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1])); - } - - /** - * 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 array((int) $row[$startcol], (int) $row[$startcol + 1]); - } - - /** - * 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 = NewsletterRecipientsPeer::getOMClass(); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = NewsletterRecipientsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = NewsletterRecipientsPeer::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; - NewsletterRecipientsPeer::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 (NewsletterRecipients object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = NewsletterRecipientsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = NewsletterRecipientsPeer::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 + NewsletterRecipientsPeer::NUM_HYDRATE_COLUMNS; - } else { - $cls = NewsletterRecipientsPeer::getOMClass($row, $startcol); - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - NewsletterRecipientsPeer::addInstanceToPool($obj, $key); - } - - return array($obj, $col); - } - - - /** - * Returns the number of rows matching criteria, joining the related Newsletter 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 doCountJoinNewsletter(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(NewsletterRecipientsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - NewsletterRecipientsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(NewsletterRecipientsPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, NewsletterPeer::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; - } - - - /** - * 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(NewsletterRecipientsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - NewsletterRecipientsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(NewsletterRecipientsPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(NewsletterRecipientsPeer::FOS_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 NewsletterRecipients objects pre-filled with their Newsletter 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 NewsletterRecipients objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinNewsletter(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(NewsletterRecipientsPeer::DATABASE_NAME); - } - - NewsletterRecipientsPeer::addSelectColumns($criteria); - $startcol = NewsletterRecipientsPeer::NUM_HYDRATE_COLUMNS; - NewsletterPeer::addSelectColumns($criteria); - - $criteria->addJoin(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, NewsletterPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = NewsletterRecipientsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = NewsletterRecipientsPeer::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 = NewsletterRecipientsPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - NewsletterRecipientsPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = NewsletterPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = NewsletterPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = NewsletterPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - NewsletterPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (NewsletterRecipients) to $obj2 (Newsletter) - $obj2->addNewsletterRecipients($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Selects a collection of NewsletterRecipients 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 NewsletterRecipients 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(NewsletterRecipientsPeer::DATABASE_NAME); - } - - NewsletterRecipientsPeer::addSelectColumns($criteria); - $startcol = NewsletterRecipientsPeer::NUM_HYDRATE_COLUMNS; - GroupPeer::addSelectColumns($criteria); - - $criteria->addJoin(NewsletterRecipientsPeer::FOS_GROUP_ID, GroupPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = NewsletterRecipientsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = NewsletterRecipientsPeer::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 = NewsletterRecipientsPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - NewsletterRecipientsPeer::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 (NewsletterRecipients) to $obj2 (Group) - $obj2->addNewsletterRecipients($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(NewsletterRecipientsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - NewsletterRecipientsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(NewsletterRecipientsPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, NewsletterPeer::ID, $join_behavior); - - $criteria->addJoin(NewsletterRecipientsPeer::FOS_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 NewsletterRecipients 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 NewsletterRecipients 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(NewsletterRecipientsPeer::DATABASE_NAME); - } - - NewsletterRecipientsPeer::addSelectColumns($criteria); - $startcol2 = NewsletterRecipientsPeer::NUM_HYDRATE_COLUMNS; - - NewsletterPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + NewsletterPeer::NUM_HYDRATE_COLUMNS; - - GroupPeer::addSelectColumns($criteria); - $startcol4 = $startcol3 + GroupPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, NewsletterPeer::ID, $join_behavior); - - $criteria->addJoin(NewsletterRecipientsPeer::FOS_GROUP_ID, GroupPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = NewsletterRecipientsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = NewsletterRecipientsPeer::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 = NewsletterRecipientsPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - NewsletterRecipientsPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Newsletter rows - - $key2 = NewsletterPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = NewsletterPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = NewsletterPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - NewsletterPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (NewsletterRecipients) to the collection in $obj2 (Newsletter) - $obj2->addNewsletterRecipients($obj1); - } // if joined row not null - - // Add objects for joined Group rows - - $key3 = GroupPeer::getPrimaryKeyHashFromRow($row, $startcol3); - if ($key3 !== null) { - $obj3 = GroupPeer::getInstanceFromPool($key3); - if (!$obj3) { - - $cls = GroupPeer::getOMClass(); - - $obj3 = new $cls(); - $obj3->hydrate($row, $startcol3); - GroupPeer::addInstanceToPool($obj3, $key3); - } // if obj3 loaded - - // Add the $obj1 (NewsletterRecipients) to the collection in $obj3 (Group) - $obj3->addNewsletterRecipients($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining the related Newsletter 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 doCountJoinAllExceptNewsletter(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(NewsletterRecipientsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - NewsletterRecipientsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY should not affect count - - // Set the correct dbName - $criteria->setDbName(NewsletterRecipientsPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(NewsletterRecipientsPeer::FOS_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; - } - - - /** - * 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 doCountJoinAllExceptGroup(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(NewsletterRecipientsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - NewsletterRecipientsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY should not affect count - - // Set the correct dbName - $criteria->setDbName(NewsletterRecipientsPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, NewsletterPeer::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 NewsletterRecipients objects pre-filled with all related objects except Newsletter. - * - * @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 NewsletterRecipients objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAllExceptNewsletter(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - // $criteria->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(NewsletterRecipientsPeer::DATABASE_NAME); - } - - NewsletterRecipientsPeer::addSelectColumns($criteria); - $startcol2 = NewsletterRecipientsPeer::NUM_HYDRATE_COLUMNS; - - GroupPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + GroupPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(NewsletterRecipientsPeer::FOS_GROUP_ID, GroupPeer::ID, $join_behavior); - - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = NewsletterRecipientsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = NewsletterRecipientsPeer::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 = NewsletterRecipientsPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - NewsletterRecipientsPeer::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 already loaded - - // Add the $obj1 (NewsletterRecipients) to the collection in $obj2 (Group) - $obj2->addNewsletterRecipients($obj1); - - } // if joined row is not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Selects a collection of NewsletterRecipients objects pre-filled with all related objects except Group. - * - * @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 NewsletterRecipients objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAllExceptGroup(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - // $criteria->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(NewsletterRecipientsPeer::DATABASE_NAME); - } - - NewsletterRecipientsPeer::addSelectColumns($criteria); - $startcol2 = NewsletterRecipientsPeer::NUM_HYDRATE_COLUMNS; - - NewsletterPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + NewsletterPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, NewsletterPeer::ID, $join_behavior); - - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = NewsletterRecipientsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = NewsletterRecipientsPeer::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 = NewsletterRecipientsPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - NewsletterRecipientsPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Newsletter rows - - $key2 = NewsletterPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = NewsletterPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = NewsletterPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - NewsletterPeer::addInstanceToPool($obj2, $key2); - } // if $obj2 already loaded - - // Add the $obj1 (NewsletterRecipients) to the collection in $obj2 (Newsletter) - $obj2->addNewsletterRecipients($obj1); - - } // if joined row is 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(NewsletterRecipientsPeer::DATABASE_NAME)->getTable(NewsletterRecipientsPeer::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseNewsletterRecipientsPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseNewsletterRecipientsPeer::TABLE_NAME)) { - $dbMap->addTableObject(new \Trinity\Bundle\NewsletterBundle\Model\map\NewsletterRecipientsTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * - * @return string ClassName - */ - public static function getOMClass($row = 0, $colnum = 0) - { - - $event = new DetectOMClassEvent(NewsletterRecipientsPeer::OM_CLASS); - EventDispatcherProxy::trigger('om.detect', $event); - if($event->isDetected()){ - return $event->getDetectedClass(); - } - - return NewsletterRecipientsPeer::OM_CLASS; - } - - /** - * Performs an INSERT on the database, given a NewsletterRecipients or Criteria object. - * - * @param mixed $values Criteria or NewsletterRecipients 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(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from NewsletterRecipients object - } - - - // Set the correct dbName - $criteria->setDbName(NewsletterRecipientsPeer::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 (Exception $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Performs an UPDATE on the database, given a NewsletterRecipients or Criteria object. - * - * @param mixed $values Criteria or NewsletterRecipients 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(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(NewsletterRecipientsPeer::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID); - $value = $criteria->remove(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID); - if ($value) { - $selectCriteria->add(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(NewsletterRecipientsPeer::TABLE_NAME); - } - - $comparison = $criteria->getComparison(NewsletterRecipientsPeer::FOS_GROUP_ID); - $value = $criteria->remove(NewsletterRecipientsPeer::FOS_GROUP_ID); - if ($value) { - $selectCriteria->add(NewsletterRecipientsPeer::FOS_GROUP_ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(NewsletterRecipientsPeer::TABLE_NAME); - } - - } else { // $values is NewsletterRecipients object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(NewsletterRecipientsPeer::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Deletes all rows from the nws_newsletter_recipients 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(NewsletterRecipientsPeer::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(NewsletterRecipientsPeer::TABLE_NAME, $con, NewsletterRecipientsPeer::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). - NewsletterRecipientsPeer::clearInstancePool(); - NewsletterRecipientsPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs a DELETE on the database, given a NewsletterRecipients or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or NewsletterRecipients 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(NewsletterRecipientsPeer::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. - NewsletterRecipientsPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof NewsletterRecipients) { // it's a model object - // invalidate the cache for this single object - NewsletterRecipientsPeer::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(NewsletterRecipientsPeer::DATABASE_NAME); - // primary key is composite; we therefore, expect - // the primary key passed to be an array of pkey values - if (count($values) == count($values, COUNT_RECURSIVE)) { - // array is not multi-dimensional - $values = array($values); - } - foreach ($values as $value) { - $criterion = $criteria->getNewCriterion(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $value[0]); - $criterion->addAnd($criteria->getNewCriterion(NewsletterRecipientsPeer::FOS_GROUP_ID, $value[1])); - $criteria->addOr($criterion); - // we can invalidate the cache for this single PK - NewsletterRecipientsPeer::removeInstanceFromPool($value); - } - } - - // Set the correct dbName - $criteria->setDbName(NewsletterRecipientsPeer::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); - NewsletterRecipientsPeer::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (Exception $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given NewsletterRecipients 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 NewsletterRecipients $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(NewsletterRecipientsPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(NewsletterRecipientsPeer::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(NewsletterRecipientsPeer::DATABASE_NAME, NewsletterRecipientsPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve object using using composite pkey values. - * @param int $nws_newsletter_id - * @param int $fos_group_id - * @param PropelPDO $con - * @return NewsletterRecipients - */ - public static function retrieveByPK($nws_newsletter_id, $fos_group_id, PropelPDO $con = null) { - $_instancePoolKey = serialize(array((string) $nws_newsletter_id, (string) $fos_group_id)); - if (null !== ($obj = NewsletterRecipientsPeer::getInstanceFromPool($_instancePoolKey))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(NewsletterRecipientsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - $criteria = new Criteria(NewsletterRecipientsPeer::DATABASE_NAME); - $criteria->add(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $nws_newsletter_id); - $criteria->add(NewsletterRecipientsPeer::FOS_GROUP_ID, $fos_group_id); - $v = NewsletterRecipientsPeer::doSelect($criteria, $con); - - return !empty($v) ? $v[0] : null; - } -} // BaseNewsletterRecipientsPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseNewsletterRecipientsPeer::buildTableMap(); - -EventDispatcherProxy::trigger(array('construct','peer.construct'), new PeerEvent('Trinity\Bundle\NewsletterBundle\Model\om\BaseNewsletterRecipientsPeer')); diff --git a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterRecipientsQuery.php b/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterRecipientsQuery.php deleted file mode 100644 index d36551c..0000000 --- a/vendor/trinity/src/Trinity/Bundle/NewsletterBundle/Model/om/BaseNewsletterRecipientsQuery.php +++ /dev/null @@ -1,581 +0,0 @@ -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(array(12, 34), $con); - * - * - * @param array $key Primary key to use for the query - A Primary key composition: [$nws_newsletter_id, $fos_group_id] - * @param PropelPDO $con an optional connection object - * - * @return NewsletterRecipients|NewsletterRecipients[]|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = NewsletterRecipientsPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) { - // the object is already in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getConnection(NewsletterRecipientsPeer::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 NewsletterRecipients A model object, or null if the key is not found - * @throws PropelException - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT `nws_newsletter_id`, `fos_group_id` FROM `nws_newsletter_recipients` WHERE `nws_newsletter_id` = :p0 AND `fos_group_id` = :p1'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); - $stmt->bindValue(':p1', $key[1], 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)) { - $cls = NewsletterRecipientsPeer::getOMClass(); - $obj = new $cls; - $obj->hydrate($row); - NewsletterRecipientsPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); - } - $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 NewsletterRecipients|NewsletterRecipients[]|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(array(12, 56), array(832, 123), array(123, 456)), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|NewsletterRecipients[]|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 NewsletterRecipientsQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - $this->addUsingAlias(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $key[0], Criteria::EQUAL); - $this->addUsingAlias(NewsletterRecipientsPeer::FOS_GROUP_ID, $key[1], Criteria::EQUAL); - - return $this; - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return NewsletterRecipientsQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - if (empty($keys)) { - return $this->add(null, '1<>1', Criteria::CUSTOM); - } - foreach ($keys as $key) { - $cton0 = $this->getNewCriterion(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $key[0], Criteria::EQUAL); - $cton1 = $this->getNewCriterion(NewsletterRecipientsPeer::FOS_GROUP_ID, $key[1], Criteria::EQUAL); - $cton0->addAnd($cton1); - $this->addOr($cton0); - } - - return $this; - } - - /** - * Filter the query on the nws_newsletter_id column - * - * Example usage: - * - * $query->filterByNwsNewsletterId(1234); // WHERE nws_newsletter_id = 1234 - * $query->filterByNwsNewsletterId(array(12, 34)); // WHERE nws_newsletter_id IN (12, 34) - * $query->filterByNwsNewsletterId(array('min' => 12)); // WHERE nws_newsletter_id >= 12 - * $query->filterByNwsNewsletterId(array('max' => 12)); // WHERE nws_newsletter_id <= 12 - * - * - * @see filterByNewsletter() - * - * @param mixed $nwsNewsletterId 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 NewsletterRecipientsQuery The current query, for fluid interface - */ - public function filterByNwsNewsletterId($nwsNewsletterId = null, $comparison = null) - { - if (is_array($nwsNewsletterId)) { - $useMinMax = false; - if (isset($nwsNewsletterId['min'])) { - $this->addUsingAlias(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $nwsNewsletterId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($nwsNewsletterId['max'])) { - $this->addUsingAlias(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $nwsNewsletterId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $nwsNewsletterId, $comparison); - } - - /** - * Filter the query on the fos_group_id column - * - * Example usage: - * - * $query->filterByFosGroupId(1234); // WHERE fos_group_id = 1234 - * $query->filterByFosGroupId(array(12, 34)); // WHERE fos_group_id IN (12, 34) - * $query->filterByFosGroupId(array('min' => 12)); // WHERE fos_group_id >= 12 - * $query->filterByFosGroupId(array('max' => 12)); // WHERE fos_group_id <= 12 - * - * - * @see filterByGroup() - * - * @param mixed $fosGroupId 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 NewsletterRecipientsQuery The current query, for fluid interface - */ - public function filterByFosGroupId($fosGroupId = null, $comparison = null) - { - if (is_array($fosGroupId)) { - $useMinMax = false; - if (isset($fosGroupId['min'])) { - $this->addUsingAlias(NewsletterRecipientsPeer::FOS_GROUP_ID, $fosGroupId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($fosGroupId['max'])) { - $this->addUsingAlias(NewsletterRecipientsPeer::FOS_GROUP_ID, $fosGroupId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(NewsletterRecipientsPeer::FOS_GROUP_ID, $fosGroupId, $comparison); - } - - /** - * Filter the query by a related Newsletter object - * - * @param Newsletter|PropelObjectCollection $newsletter The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return NewsletterRecipientsQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByNewsletter($newsletter, $comparison = null) - { - if ($newsletter instanceof Newsletter) { - return $this - ->addUsingAlias(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $newsletter->getId(), $comparison); - } elseif ($newsletter instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID, $newsletter->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByNewsletter() only accepts arguments of type Newsletter or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the Newsletter relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return NewsletterRecipientsQuery The current query, for fluid interface - */ - public function joinNewsletter($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Newsletter'); - - // 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, 'Newsletter'); - } - - return $this; - } - - /** - * Use the Newsletter relation Newsletter 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 \Trinity\Bundle\NewsletterBundle\Model\NewsletterQuery A secondary query class using the current class as primary query - */ - public function useNewsletterQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinNewsletter($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Newsletter', '\Trinity\Bundle\NewsletterBundle\Model\NewsletterQuery'); - } - - /** - * 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 NewsletterRecipientsQuery 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(NewsletterRecipientsPeer::FOS_GROUP_ID, $group->getId(), $comparison); - } elseif ($group instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(NewsletterRecipientsPeer::FOS_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 NewsletterRecipientsQuery 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 \FOS\UserBundle\Propel\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', '\FOS\UserBundle\Propel\GroupQuery'); - } - - /** - * Exclude object from result - * - * @param NewsletterRecipients $newsletterRecipients Object to remove from the list of results - * - * @return NewsletterRecipientsQuery The current query, for fluid interface - */ - public function prune($newsletterRecipients = null) - { - if ($newsletterRecipients) { - $this->addCond('pruneCond0', $this->getAliasedColName(NewsletterRecipientsPeer::NWS_NEWSLETTER_ID), $newsletterRecipients->getNwsNewsletterId(), Criteria::NOT_EQUAL); - $this->addCond('pruneCond1', $this->getAliasedColName(NewsletterRecipientsPeer::FOS_GROUP_ID), $newsletterRecipients->getFosGroupId(), Criteria::NOT_EQUAL); - $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); - } - - return $this; - } - - /** - * Code to execute before every SELECT statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreSelect(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger('query.select.pre', new QueryEvent($this)); - - return $this->preSelect($con); - } - - /** - * Code to execute before every DELETE statement - * - * @param PropelPDO $con The connection object used by the query - */ - protected function basePreDelete(PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.pre','query.delete.pre'), new QueryEvent($this)); - - return $this->preDelete($con); - } - - /** - * Code to execute after every DELETE statement - * - * @param int $affectedRows the number of deleted rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostDelete($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('delete.post','query.delete.post'), new QueryEvent($this)); - - return $this->postDelete($affectedRows, $con); - } - - /** - * Code to execute before every UPDATE statement - * - * @param array $values The associative array of columns and values for the update - * @param PropelPDO $con The connection object used by the query - * @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), otherwise it is a series of save() calls on all the found objects - */ - protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false) - { - // event behavior - EventDispatcherProxy::trigger(array('update.pre', 'query.update.pre'), new QueryEvent($this)); - - return $this->preUpdate($values, $con, $forceIndividualSaves); - } - - /** - * Code to execute after every UPDATE statement - * - * @param int $affectedRows the number of updated rows - * @param PropelPDO $con The connection object used by the query - */ - protected function basePostUpdate($affectedRows, PropelPDO $con) - { - // event behavior - EventDispatcherProxy::trigger(array('update.post', 'query.update.post'), new QueryEvent($this)); - - return $this->postUpdate($affectedRows, $con); - } - - // extend behavior - public function setFormatter($formatter) - { - if (is_string($formatter) && $formatter === \ModelCriteria::FORMAT_ON_DEMAND) { - $formatter = '\Glorpen\Propel\PropelBundle\Formatter\PropelOnDemandFormatter'; - } - - return parent::setFormatter($formatter); - } -} diff --git a/vendor/trinity/src/Trinity/Bundle/NotificationBundle/Resources/config/propel/schema.xml b/vendor/trinity/src/Trinity/Bundle/NotificationBundle/Resources/config/propel/schema.xml index 1618ff0..e7e111a 100644 --- a/vendor/trinity/src/Trinity/Bundle/NotificationBundle/Resources/config/propel/schema.xml +++ b/vendor/trinity/src/Trinity/Bundle/NotificationBundle/Resources/config/propel/schema.xml @@ -7,7 +7,7 @@ - + @@ -26,4 +26,4 @@
-
\ No newline at end of file + diff --git a/vendor/trinity/src/Trinity/Bundle/UserBundle/Flash/Flash.php b/vendor/trinity/src/Trinity/Bundle/UserBundle/Flash/Flash.php index 3a3d315..8fc5f9c 100644 --- a/vendor/trinity/src/Trinity/Bundle/UserBundle/Flash/Flash.php +++ b/vendor/trinity/src/Trinity/Bundle/UserBundle/Flash/Flash.php @@ -4,17 +4,48 @@ namespace Trinity\Bundle\UserBundle\Flash; abstract class Flash { - protected $message = null; + protected $message = null; - public function __construct($message) - { - $this->message = $message; - } + protected $options = array(); - public function getMessage() - { - return $this->message; - } + public function __construct($message, array $options = array()) + { + $this->message = $message; + $this->options = $options; + } - abstract public function getTemplate(); + public function setOptions(array $options) + { + $this->options = $options; + + return $this; + } + + public function setOption($name, $value) + { + $this->options[$name] = $value; + + return $this; + } + + public function getOptions() + { + return $this->options; + } + + public function getOption($name, $defaultValue = null) + { + if (array_key_exists($name, $this->options)) { + return $this->options[$name]; + } + + return null; + } + + public function getMessage() + { + return $this->message; + } + + abstract public function getTemplate(); } diff --git a/vendor/trinity/src/Trinity/Bundle/VarsEditorBundle/Service/Config.php b/vendor/trinity/src/Trinity/Bundle/VarsEditorBundle/Service/Config.php index 88e432b..a6dbc66 100644 --- a/vendor/trinity/src/Trinity/Bundle/VarsEditorBundle/Service/Config.php +++ b/vendor/trinity/src/Trinity/Bundle/VarsEditorBundle/Service/Config.php @@ -47,29 +47,21 @@ class Config foreach ($config['fieldsets'] as $fieldset) { if (!is_null($locale) && isset($fieldset['tabs'])) { - if (!isset($fieldset['tabs'][$locale])) { - return $default; - } - - foreach ($fieldset['tabs'][$locale]['vars'] as $var) { - if (!isset($var['key'], $var['value'])) { - return $default; - } - - if ($var['key'] === $key) { - return $var['value']; + if (isset($fieldset['tabs'][$locale])) { + foreach ($fieldset['tabs'][$locale]['vars'] as $var) { + if (isset($var['key'], $var['value'])) { + if ($var['key'] === $key) { + return $var['value']; + } + } } } - } elseif (empty($fieldset['vars'])) { - return $default; - } else { + } elseif (!empty($fieldset['vars'])) { foreach ($fieldset['vars'] as $var) { - if (!isset($var['key'], $var['value'])) { - return $default; - } - - if ($var['key'] === $key) { - return $var['value']; + if (isset($var['key'], $var['value'])) { + if ($var['key'] === $key) { + return $var['value']; + } } } }