upgrade trinity + js cookie alert
This commit is contained in:
parent
50f43d3cba
commit
05bb769be0
|
@ -143,7 +143,7 @@ if (!readCookie('private_life')) {
|
||||||
createCookie('private_life', '1', 365);
|
createCookie('private_life', '1', 365);
|
||||||
|
|
||||||
$('#cookie').removeClass('hide').css({
|
$('#cookie').removeClass('hide').css({
|
||||||
top: 57,
|
bottom: 0,
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
width: '100%'
|
width: '100%'
|
||||||
});
|
});
|
||||||
|
|
BIN
vendor/trinity/src/Trinity/.svn/wc.db
vendored
BIN
vendor/trinity/src/Trinity/.svn/wc.db
vendored
Binary file not shown.
|
@ -72,6 +72,7 @@ class DefaultController extends Controller
|
||||||
'menu_render' => $renderer->render($menu),
|
'menu_render' => $renderer->render($menu),
|
||||||
'menu' => $menu,
|
'menu' => $menu,
|
||||||
'logo' => $this->config['logo'],
|
'logo' => $this->config['logo'],
|
||||||
|
'route_name' => $this->config['route_name'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ class Configuration implements ConfigurationInterface
|
||||||
->scalarNode('template')->defaultValue('TrinityAdminMenuBundle:Default:mainMenu.html.twig')->end()
|
->scalarNode('template')->defaultValue('TrinityAdminMenuBundle:Default:mainMenu.html.twig')->end()
|
||||||
->scalarNode('title')->defaultValue('Admin menu')->end()
|
->scalarNode('title')->defaultValue('Admin menu')->end()
|
||||||
->scalarNode('logo')->defaultValue('/bundles/trinityadminmenu/img/logo.png')->end()
|
->scalarNode('logo')->defaultValue('/bundles/trinityadminmenu/img/logo.png')->end()
|
||||||
|
->scalarNode('route_name')->defaultValue('TrinityDashBoardBundle_index')->end()
|
||||||
|
|
||||||
->arrayNode('items')
|
->arrayNode('items')
|
||||||
->prototype('array')
|
->prototype('array')
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div>
|
<div>
|
||||||
{% if logo %}
|
{% if logo %}
|
||||||
<a href="/">
|
<a href="{{ path(route_name) }}">
|
||||||
{% if logo|slice(0, 4) == '<img' %}
|
{% if logo|slice(0, 4) == '<img' %}
|
||||||
{{ logo|raw }}
|
{{ logo|raw }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<parameter key="routing.loader.db.class">Trinity\Bundle\ContentManagerBundle\Routing\NodeLoader</parameter>
|
<parameter key="routing.loader.db.class">Trinity\Bundle\ContentManagerBundle\Routing\NodeLoader</parameter>
|
||||||
<parameter key="routeur.cache.class">Trinity\Bundle\ContentManagerBundle\Routing\Cache</parameter>
|
<parameter key="routeur.cache.class">Trinity\Bundle\ContentManagerBundle\Routing\Cache</parameter>
|
||||||
<parameter key="object.twig.extension.class">Trinity\Bundle\ContentManagerBundle\Twig\Extension\ObjectExtension</parameter>
|
<parameter key="object.twig.extension.class">Trinity\Bundle\ContentManagerBundle\Twig\Extension\ObjectExtension</parameter>
|
||||||
|
<parameter key="seasons.twig.extension.class">Trinity\Bundle\ContentManagerBundle\Twig\Extension\SeasonsExtension</parameter>
|
||||||
<parameter key="page.twig.extension.class">Trinity\Bundle\ContentManagerBundle\Twig\Extension\PageExtension</parameter>
|
<parameter key="page.twig.extension.class">Trinity\Bundle\ContentManagerBundle\Twig\Extension\PageExtension</parameter>
|
||||||
<parameter key="url.twig.extension.class">Trinity\Bundle\ContentManagerBundle\Twig\Extension\UrlExtension</parameter>
|
<parameter key="url.twig.extension.class">Trinity\Bundle\ContentManagerBundle\Twig\Extension\UrlExtension</parameter>
|
||||||
<parameter key="block.twig.extension.class">Trinity\Bundle\ContentManagerBundle\Twig\Extension\BlockExtension</parameter>
|
<parameter key="block.twig.extension.class">Trinity\Bundle\ContentManagerBundle\Twig\Extension\BlockExtension</parameter>
|
||||||
|
|
|
@ -57,17 +57,21 @@ class Media extends BaseMedia
|
||||||
return basename($this->getFile());
|
return basename($this->getFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save(\PropelPDO $con = null)
|
public function setTypeId($id)
|
||||||
{
|
{
|
||||||
if (!$this->getTypeId() && $this->getFileAsFile()) {
|
if ($id === '') {
|
||||||
$this->setTypeId(TypePeer::getTypeFor($this->getFileAsFile()));
|
$id = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::save($con);
|
parent::setTypeId($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postSave(\PropelPDO $con = null)
|
public function postSave(\PropelPDO $con = null)
|
||||||
{
|
{
|
||||||
|
// if (!$this->getTypeId() && $this->getFileAsFile()) {
|
||||||
|
// $this->setTypeId(TypePeer::getTypeFor($this->getFileAsFile()));
|
||||||
|
// }
|
||||||
|
|
||||||
if ($this->hasUploadedFile()) {
|
if ($this->hasUploadedFile()) {
|
||||||
if (@getimagesize($this->getWebPathForFile())) {
|
if (@getimagesize($this->getWebPathForFile())) {
|
||||||
Image::create($this->getWebPathForFile())
|
Image::create($this->getWebPathForFile())
|
||||||
|
|
|
@ -9,7 +9,10 @@ class TypePeer extends BaseTypePeer
|
||||||
{
|
{
|
||||||
public static function getTypeFor(File $file)
|
public static function getTypeFor(File $file)
|
||||||
{
|
{
|
||||||
|
var_dump($file->getMimeType());
|
||||||
$type = TypeQuery::create()->findOneByMimes('%'.$file->getMimeType().'%');
|
$type = TypeQuery::create()->findOneByMimes('%'.$file->getMimeType().'%');
|
||||||
|
var_dump($type);
|
||||||
|
die;
|
||||||
|
|
||||||
return count($type) ? $type->getId() : null;
|
return count($type) ? $type->getId() : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class CategoryTableMap extends TableMap
|
||||||
public function buildRelations()
|
public function buildRelations()
|
||||||
{
|
{
|
||||||
$this->addRelation('CategoryRelatedByCategoryId', 'Trinity\\Bundle\\MediaBundle\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), null, 'CASCADE');
|
$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');
|
$this->addRelation('CategoryRelatedById', 'Trinity\\Bundle\\MediaBundle\\Model\\Category', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), null, 'CASCADE', 'CategoriesRelatedById');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,8 @@ class MediaTableMap extends TableMap
|
||||||
*/
|
*/
|
||||||
public function buildRelations()
|
public function buildRelations()
|
||||||
{
|
{
|
||||||
$this->addRelation('Type', 'Trinity\\Bundle\\MediaBundle\\Model\\Type', RelationMap::MANY_TO_ONE, array('type_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, 'CASCADE');
|
$this->addRelation('Category', 'Trinity\\Bundle\\MediaBundle\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), null, null);
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,7 +59,7 @@ class TypeTableMap extends TableMap
|
||||||
*/
|
*/
|
||||||
public function buildRelations()
|
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()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,7 @@ use \PDOStatement;
|
||||||
use \Propel;
|
use \Propel;
|
||||||
use \PropelException;
|
use \PropelException;
|
||||||
use \PropelPDO;
|
use \PropelPDO;
|
||||||
|
use Trinity\Bundle\MediaBundle\Model\MediaPeer;
|
||||||
use Trinity\Bundle\MediaBundle\Model\Type;
|
use Trinity\Bundle\MediaBundle\Model\Type;
|
||||||
use Trinity\Bundle\MediaBundle\Model\TypePeer;
|
use Trinity\Bundle\MediaBundle\Model\TypePeer;
|
||||||
use Trinity\Bundle\MediaBundle\Model\TypeQuery;
|
use Trinity\Bundle\MediaBundle\Model\TypeQuery;
|
||||||
|
@ -417,6 +418,9 @@ abstract class BaseTypePeer
|
||||||
*/
|
*/
|
||||||
public static function clearRelatedInstancePool()
|
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
|
// use transaction because $criteria could contain info
|
||||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||||
$con->beginTransaction();
|
$con->beginTransaction();
|
||||||
|
TypePeer::doOnDeleteSetNull(new Criteria(TypePeer::DATABASE_NAME), $con);
|
||||||
$affectedRows += BasePeer::doDeleteAll(TypePeer::TABLE_NAME, $con, TypePeer::DATABASE_NAME);
|
$affectedRows += BasePeer::doDeleteAll(TypePeer::TABLE_NAME, $con, TypePeer::DATABASE_NAME);
|
||||||
// Because this db requires some delete cascade/set null emulation, we have to
|
// Because this db requires some delete cascade/set null emulation, we have to
|
||||||
// clear the cached instance *after* the emulation has happened (since
|
// clear the cached instance *after* the emulation has happened (since
|
||||||
|
@ -679,24 +684,14 @@ abstract class BaseTypePeer
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($values instanceof Criteria) {
|
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
|
// rename for clarity
|
||||||
$criteria = clone $values;
|
$criteria = clone $values;
|
||||||
} elseif ($values instanceof Type) { // it's a model object
|
} 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
|
// create criteria based on pk values
|
||||||
$criteria = $values->buildPkeyCriteria();
|
$criteria = $values->buildPkeyCriteria();
|
||||||
} else { // it's a primary key, or an array of pks
|
} else { // it's a primary key, or an array of pks
|
||||||
$criteria = new Criteria(TypePeer::DATABASE_NAME);
|
$criteria = new Criteria(TypePeer::DATABASE_NAME);
|
||||||
$criteria->add(TypePeer::ID, (array) $values, Criteria::IN);
|
$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
|
// Set the correct dbName
|
||||||
|
@ -709,6 +704,23 @@ abstract class BaseTypePeer
|
||||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||||
$con->beginTransaction();
|
$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);
|
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||||
TypePeer::clearRelatedInstancePool();
|
TypePeer::clearRelatedInstancePool();
|
||||||
$con->commit();
|
$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.
|
* Validates all modified columns of given Type object.
|
||||||
* If parameter $columns is either a single column name or an array of column names
|
* If parameter $columns is either a single column name or an array of column names
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
<database name="default" namespace="Trinity\Bundle\MediaBundle\Model" defaultIdMethod="native" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.propelorm.org/1.6/database.xsd">
|
<database name="default" namespace="Trinity\Bundle\MediaBundle\Model" defaultIdMethod="native" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.propelorm.org/1.6/database.xsd">
|
||||||
<table name="media_file" phpName="Media">
|
<table name="media_file" phpName="Media">
|
||||||
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
|
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
|
||||||
<column name="type_id" type="integer" />
|
<column name="type_id" type="integer" required="false" />
|
||||||
<column name="category_id" type="integer" />
|
<column name="category_id" required="false" type="integer" />
|
||||||
|
|
||||||
<foreign-key foreignTable="media_type" onDelete="none" onUpdate="cascade">
|
<foreign-key foreignTable="media_type" onUpdate="SETNULL" onDelete="SETNULL">
|
||||||
<reference local="type_id" foreign="id" />
|
<reference local="type_id" foreign="id" />
|
||||||
</foreign-key>
|
</foreign-key>
|
||||||
<foreign-key foreignTable="media_category" onDelete="none" onUpdate="cascade">
|
<foreign-key foreignTable="media_category">
|
||||||
<reference local="category_id" foreign="id" />
|
<reference local="category_id" foreign="id" />
|
||||||
</foreign-key>
|
</foreign-key>
|
||||||
|
|
||||||
|
|
|
@ -145,13 +145,12 @@
|
||||||
var mimes = $(this).data('mime');
|
var mimes = $(this).data('mime');
|
||||||
var iconType = $(this).data('icon');
|
var iconType = $(this).data('icon');
|
||||||
|
|
||||||
if(mimes) {
|
if (mimes) {
|
||||||
tinymce.EditorManager.activeEditor.insertContent('<a target="_blank" href="'+ $(this).data('file') +'"><img src="' + iconType +'"></a>');
|
tinymce.EditorManager.activeEditor.insertContent('<a target="_blank" href="'+ $(this).data('file') +'"><img src="' + iconType +'"></a>');
|
||||||
}else{
|
} else{
|
||||||
tinymce.EditorManager.activeEditor.insertContent('<img src="' + $(this).data('file') +'">');
|
tinymce.EditorManager.activeEditor.insertContent('<img src="' + $(this).data('file') +'">');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
close();
|
close();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,100 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\map;
|
|
||||||
|
|
||||||
use \RelationMap;
|
|
||||||
use \TableMap;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class defines the structure of the 'nws_block' table.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This map class is used by Propel to do runtime db structure discovery.
|
|
||||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
|
||||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
|
||||||
* (i.e. if it's a text column type).
|
|
||||||
*
|
|
||||||
* @package propel.generator.vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map
|
|
||||||
*/
|
|
||||||
class BlockTableMap extends TableMap
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The (dot-path) name of this class
|
|
||||||
*/
|
|
||||||
const CLASS_NAME = 'vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map.BlockTableMap';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the table attributes, columns and validators
|
|
||||||
* Relations are not initialized by this method since they are lazy loaded
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function initialize()
|
|
||||||
{
|
|
||||||
// attributes
|
|
||||||
$this->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
|
|
|
@ -1,85 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\map;
|
|
||||||
|
|
||||||
use \RelationMap;
|
|
||||||
use \TableMap;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class defines the structure of the 'nws_block_version' table.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This map class is used by Propel to do runtime db structure discovery.
|
|
||||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
|
||||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
|
||||||
* (i.e. if it's a text column type).
|
|
||||||
*
|
|
||||||
* @package propel.generator.vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map
|
|
||||||
*/
|
|
||||||
class BlockVersionTableMap extends TableMap
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The (dot-path) name of this class
|
|
||||||
*/
|
|
||||||
const CLASS_NAME = 'vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map.BlockVersionTableMap';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the table attributes, columns and validators
|
|
||||||
* Relations are not initialized by this method since they are lazy loaded
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function initialize()
|
|
||||||
{
|
|
||||||
// attributes
|
|
||||||
$this->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
|
|
|
@ -1,99 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\map;
|
|
||||||
|
|
||||||
use \RelationMap;
|
|
||||||
use \TableMap;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class defines the structure of the 'nws_model' table.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This map class is used by Propel to do runtime db structure discovery.
|
|
||||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
|
||||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
|
||||||
* (i.e. if it's a text column type).
|
|
||||||
*
|
|
||||||
* @package propel.generator.vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map
|
|
||||||
*/
|
|
||||||
class ModelTableMap extends TableMap
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The (dot-path) name of this class
|
|
||||||
*/
|
|
||||||
const CLASS_NAME = 'vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map.ModelTableMap';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the table attributes, columns and validators
|
|
||||||
* Relations are not initialized by this method since they are lazy loaded
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function initialize()
|
|
||||||
{
|
|
||||||
// attributes
|
|
||||||
$this->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
|
|
|
@ -1,84 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\map;
|
|
||||||
|
|
||||||
use \RelationMap;
|
|
||||||
use \TableMap;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class defines the structure of the 'nws_model_version' table.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This map class is used by Propel to do runtime db structure discovery.
|
|
||||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
|
||||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
|
||||||
* (i.e. if it's a text column type).
|
|
||||||
*
|
|
||||||
* @package propel.generator.vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map
|
|
||||||
*/
|
|
||||||
class ModelVersionTableMap extends TableMap
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The (dot-path) name of this class
|
|
||||||
*/
|
|
||||||
const CLASS_NAME = 'vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map.ModelVersionTableMap';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the table attributes, columns and validators
|
|
||||||
* Relations are not initialized by this method since they are lazy loaded
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function initialize()
|
|
||||||
{
|
|
||||||
// attributes
|
|
||||||
$this->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
|
|
|
@ -1,76 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\map;
|
|
||||||
|
|
||||||
use \RelationMap;
|
|
||||||
use \TableMap;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class defines the structure of the 'nws_newsletter_recipients' table.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This map class is used by Propel to do runtime db structure discovery.
|
|
||||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
|
||||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
|
||||||
* (i.e. if it's a text column type).
|
|
||||||
*
|
|
||||||
* @package propel.generator.vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map
|
|
||||||
*/
|
|
||||||
class NewsletterRecipientsTableMap extends TableMap
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The (dot-path) name of this class
|
|
||||||
*/
|
|
||||||
const CLASS_NAME = 'vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map.NewsletterRecipientsTableMap';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the table attributes, columns and validators
|
|
||||||
* Relations are not initialized by this method since they are lazy loaded
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function initialize()
|
|
||||||
{
|
|
||||||
// attributes
|
|
||||||
$this->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
|
|
|
@ -1,88 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\map;
|
|
||||||
|
|
||||||
use \RelationMap;
|
|
||||||
use \TableMap;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class defines the structure of the 'nws_newsletter' table.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This map class is used by Propel to do runtime db structure discovery.
|
|
||||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
|
||||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
|
||||||
* (i.e. if it's a text column type).
|
|
||||||
*
|
|
||||||
* @package propel.generator.vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map
|
|
||||||
*/
|
|
||||||
class NewsletterTableMap extends TableMap
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The (dot-path) name of this class
|
|
||||||
*/
|
|
||||||
const CLASS_NAME = 'vendor.trinity.src.Trinity.Bundle.NewsletterBundle.Model.map.NewsletterTableMap';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the table attributes, columns and validators
|
|
||||||
* Relations are not initialized by this method since they are lazy loaded
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function initialize()
|
|
||||||
{
|
|
||||||
// attributes
|
|
||||||
$this->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
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,992 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\om;
|
|
||||||
|
|
||||||
use \Criteria;
|
|
||||||
use \Exception;
|
|
||||||
use \ModelCriteria;
|
|
||||||
use \ModelJoin;
|
|
||||||
use \PDO;
|
|
||||||
use \Propel;
|
|
||||||
use \PropelCollection;
|
|
||||||
use \PropelException;
|
|
||||||
use \PropelObjectCollection;
|
|
||||||
use \PropelPDO;
|
|
||||||
use Glorpen\Propel\PropelBundle\Dispatcher\EventDispatcherProxy;
|
|
||||||
use Glorpen\Propel\PropelBundle\Events\QueryEvent;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Block;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\BlockPeer;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\BlockQuery;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\BlockVersion;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method BlockQuery orderById($order = Criteria::ASC) Order by the id column
|
|
||||||
* @method BlockQuery orderByName($order = Criteria::ASC) Order by the name column
|
|
||||||
* @method BlockQuery orderByValue($order = Criteria::ASC) Order by the value column
|
|
||||||
* @method BlockQuery orderByClassKey($order = Criteria::ASC) Order by the class_key column
|
|
||||||
* @method BlockQuery orderByTemplate($order = Criteria::ASC) Order by the template column
|
|
||||||
* @method BlockQuery orderByModelId($order = Criteria::ASC) Order by the model_id column
|
|
||||||
* @method BlockQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
|
||||||
* @method BlockQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
|
||||||
* @method BlockQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
|
||||||
* @method BlockQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
|
||||||
* @method BlockQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
|
||||||
*
|
|
||||||
* @method BlockQuery groupById() Group by the id column
|
|
||||||
* @method BlockQuery groupByName() Group by the name column
|
|
||||||
* @method BlockQuery groupByValue() Group by the value column
|
|
||||||
* @method BlockQuery groupByClassKey() Group by the class_key column
|
|
||||||
* @method BlockQuery groupByTemplate() Group by the template column
|
|
||||||
* @method BlockQuery groupByModelId() Group by the model_id column
|
|
||||||
* @method BlockQuery groupByCreatedAt() Group by the created_at column
|
|
||||||
* @method BlockQuery groupByUpdatedAt() Group by the updated_at column
|
|
||||||
* @method BlockQuery groupByVersion() Group by the version column
|
|
||||||
* @method BlockQuery groupByVersionCreatedAt() Group by the version_created_at column
|
|
||||||
* @method BlockQuery groupByVersionCreatedBy() Group by the version_created_by column
|
|
||||||
*
|
|
||||||
* @method BlockQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
|
||||||
* @method BlockQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
|
||||||
* @method BlockQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
|
||||||
*
|
|
||||||
* @method BlockQuery leftJoinModel($relationAlias = null) Adds a LEFT JOIN clause to the query using the Model relation
|
|
||||||
* @method BlockQuery rightJoinModel($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Model relation
|
|
||||||
* @method BlockQuery innerJoinModel($relationAlias = null) Adds a INNER JOIN clause to the query using the Model relation
|
|
||||||
*
|
|
||||||
* @method BlockQuery leftJoinBlockVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the BlockVersion relation
|
|
||||||
* @method BlockQuery rightJoinBlockVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BlockVersion relation
|
|
||||||
* @method BlockQuery innerJoinBlockVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the BlockVersion relation
|
|
||||||
*
|
|
||||||
* @method Block findOne(PropelPDO $con = null) Return the first Block matching the query
|
|
||||||
* @method Block findOneOrCreate(PropelPDO $con = null) Return the first Block matching the query, or a new Block object populated from the query conditions when no match is found
|
|
||||||
*
|
|
||||||
* @method Block findOneByName(string $name) Return the first Block filtered by the name column
|
|
||||||
* @method Block findOneByValue(string $value) Return the first Block filtered by the value column
|
|
||||||
* @method Block findOneByClassKey(string $class_key) Return the first Block filtered by the class_key column
|
|
||||||
* @method Block findOneByTemplate(string $template) Return the first Block filtered by the template column
|
|
||||||
* @method Block findOneByModelId(int $model_id) Return the first Block filtered by the model_id column
|
|
||||||
* @method Block findOneByCreatedAt(string $created_at) Return the first Block filtered by the created_at column
|
|
||||||
* @method Block findOneByUpdatedAt(string $updated_at) Return the first Block filtered by the updated_at column
|
|
||||||
* @method Block findOneByVersion(int $version) Return the first Block filtered by the version column
|
|
||||||
* @method Block findOneByVersionCreatedAt(string $version_created_at) Return the first Block filtered by the version_created_at column
|
|
||||||
* @method Block findOneByVersionCreatedBy(string $version_created_by) Return the first Block filtered by the version_created_by column
|
|
||||||
*
|
|
||||||
* @method array findById(int $id) Return Block objects filtered by the id column
|
|
||||||
* @method array findByName(string $name) Return Block objects filtered by the name column
|
|
||||||
* @method array findByValue(string $value) Return Block objects filtered by the value column
|
|
||||||
* @method array findByClassKey(string $class_key) Return Block objects filtered by the class_key column
|
|
||||||
* @method array findByTemplate(string $template) Return Block objects filtered by the template column
|
|
||||||
* @method array findByModelId(int $model_id) Return Block objects filtered by the model_id column
|
|
||||||
* @method array findByCreatedAt(string $created_at) Return Block objects filtered by the created_at column
|
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return Block objects filtered by the updated_at column
|
|
||||||
* @method array findByVersion(int $version) Return Block objects filtered by the version column
|
|
||||||
* @method array findByVersionCreatedAt(string $version_created_at) Return Block objects filtered by the version_created_at column
|
|
||||||
* @method array findByVersionCreatedBy(string $version_created_by) Return Block objects filtered by the version_created_by column
|
|
||||||
*/
|
|
||||||
abstract class BaseBlockQuery extends ModelCriteria
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Initializes internal state of BaseBlockQuery object.
|
|
||||||
*
|
|
||||||
* @param string $dbName The dabase name
|
|
||||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
|
||||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
|
||||||
*/
|
|
||||||
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
|
|
||||||
{
|
|
||||||
if (null === $dbName) {
|
|
||||||
$dbName = 'default';
|
|
||||||
}
|
|
||||||
if (null === $modelName) {
|
|
||||||
$modelName = 'Trinity\\Bundle\\NewsletterBundle\\Model\\Block';
|
|
||||||
}
|
|
||||||
parent::__construct($dbName, $modelName, $modelAlias);
|
|
||||||
EventDispatcherProxy::trigger(array('construct','query.construct'), new QueryEvent($this));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new BlockQuery object.
|
|
||||||
*
|
|
||||||
* @param string $modelAlias The alias of a model in the query
|
|
||||||
* @param BlockQuery|Criteria $criteria Optional Criteria to build the query from
|
|
||||||
*
|
|
||||||
* @return BlockQuery
|
|
||||||
*/
|
|
||||||
public static function create($modelAlias = null, $criteria = null)
|
|
||||||
{
|
|
||||||
if ($criteria instanceof BlockQuery) {
|
|
||||||
return $criteria;
|
|
||||||
}
|
|
||||||
$query = new static(null, null, $modelAlias);
|
|
||||||
|
|
||||||
if ($criteria instanceof Criteria) {
|
|
||||||
$query->mergeWith($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find object by primary key.
|
|
||||||
* Propel uses the instance pool to skip the database if the object exists.
|
|
||||||
* Go fast if the query is untouched.
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* $obj = $c->findPk(12, $con);
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
* <code>
|
|
||||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
|
||||||
* </code>
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
|
|
||||||
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByValue('fooValue'); // WHERE value = 'fooValue'
|
|
||||||
* $query->filterByValue('%fooValue%'); // WHERE value LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByClassKey('fooValue'); // WHERE class_key = 'fooValue'
|
|
||||||
* $query->filterByClassKey('%fooValue%'); // WHERE class_key LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByTemplate('fooValue'); // WHERE template = 'fooValue'
|
|
||||||
* $query->filterByTemplate('%fooValue%'); // WHERE template LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
|
||||||
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,896 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\om;
|
|
||||||
|
|
||||||
use \Criteria;
|
|
||||||
use \Exception;
|
|
||||||
use \ModelCriteria;
|
|
||||||
use \ModelJoin;
|
|
||||||
use \PDO;
|
|
||||||
use \Propel;
|
|
||||||
use \PropelCollection;
|
|
||||||
use \PropelException;
|
|
||||||
use \PropelObjectCollection;
|
|
||||||
use \PropelPDO;
|
|
||||||
use Glorpen\Propel\PropelBundle\Dispatcher\EventDispatcherProxy;
|
|
||||||
use Glorpen\Propel\PropelBundle\Events\QueryEvent;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Block;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\BlockVersion;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\BlockVersionPeer;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\BlockVersionQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method BlockVersionQuery orderById($order = Criteria::ASC) Order by the id column
|
|
||||||
* @method BlockVersionQuery orderByName($order = Criteria::ASC) Order by the name column
|
|
||||||
* @method BlockVersionQuery orderByValue($order = Criteria::ASC) Order by the value column
|
|
||||||
* @method BlockVersionQuery orderByClassKey($order = Criteria::ASC) Order by the class_key column
|
|
||||||
* @method BlockVersionQuery orderByTemplate($order = Criteria::ASC) Order by the template column
|
|
||||||
* @method BlockVersionQuery orderByModelId($order = Criteria::ASC) Order by the model_id column
|
|
||||||
* @method BlockVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
|
||||||
* @method BlockVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
|
||||||
* @method BlockVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
|
||||||
* @method BlockVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
|
||||||
* @method BlockVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
|
||||||
* @method BlockVersionQuery orderByModelIdVersion($order = Criteria::ASC) Order by the model_id_version column
|
|
||||||
*
|
|
||||||
* @method BlockVersionQuery groupById() Group by the id column
|
|
||||||
* @method BlockVersionQuery groupByName() Group by the name column
|
|
||||||
* @method BlockVersionQuery groupByValue() Group by the value column
|
|
||||||
* @method BlockVersionQuery groupByClassKey() Group by the class_key column
|
|
||||||
* @method BlockVersionQuery groupByTemplate() Group by the template column
|
|
||||||
* @method BlockVersionQuery groupByModelId() Group by the model_id column
|
|
||||||
* @method BlockVersionQuery groupByCreatedAt() Group by the created_at column
|
|
||||||
* @method BlockVersionQuery groupByUpdatedAt() Group by the updated_at column
|
|
||||||
* @method BlockVersionQuery groupByVersion() Group by the version column
|
|
||||||
* @method BlockVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
|
|
||||||
* @method BlockVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
|
|
||||||
* @method BlockVersionQuery groupByModelIdVersion() Group by the model_id_version column
|
|
||||||
*
|
|
||||||
* @method BlockVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
|
||||||
* @method BlockVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
|
||||||
* @method BlockVersionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
|
||||||
*
|
|
||||||
* @method BlockVersionQuery leftJoinBlock($relationAlias = null) Adds a LEFT JOIN clause to the query using the Block relation
|
|
||||||
* @method BlockVersionQuery rightJoinBlock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Block relation
|
|
||||||
* @method BlockVersionQuery innerJoinBlock($relationAlias = null) Adds a INNER JOIN clause to the query using the Block relation
|
|
||||||
*
|
|
||||||
* @method BlockVersion findOne(PropelPDO $con = null) Return the first BlockVersion matching the query
|
|
||||||
* @method BlockVersion findOneOrCreate(PropelPDO $con = null) Return the first BlockVersion matching the query, or a new BlockVersion object populated from the query conditions when no match is found
|
|
||||||
*
|
|
||||||
* @method BlockVersion findOneById(int $id) Return the first BlockVersion filtered by the id column
|
|
||||||
* @method BlockVersion findOneByName(string $name) Return the first BlockVersion filtered by the name column
|
|
||||||
* @method BlockVersion findOneByValue(string $value) Return the first BlockVersion filtered by the value column
|
|
||||||
* @method BlockVersion findOneByClassKey(string $class_key) Return the first BlockVersion filtered by the class_key column
|
|
||||||
* @method BlockVersion findOneByTemplate(string $template) Return the first BlockVersion filtered by the template column
|
|
||||||
* @method BlockVersion findOneByModelId(int $model_id) Return the first BlockVersion filtered by the model_id column
|
|
||||||
* @method BlockVersion findOneByCreatedAt(string $created_at) Return the first BlockVersion filtered by the created_at column
|
|
||||||
* @method BlockVersion findOneByUpdatedAt(string $updated_at) Return the first BlockVersion filtered by the updated_at column
|
|
||||||
* @method BlockVersion findOneByVersion(int $version) Return the first BlockVersion filtered by the version column
|
|
||||||
* @method BlockVersion findOneByVersionCreatedAt(string $version_created_at) Return the first BlockVersion filtered by the version_created_at column
|
|
||||||
* @method BlockVersion findOneByVersionCreatedBy(string $version_created_by) Return the first BlockVersion filtered by the version_created_by column
|
|
||||||
* @method BlockVersion findOneByModelIdVersion(int $model_id_version) Return the first BlockVersion filtered by the model_id_version column
|
|
||||||
*
|
|
||||||
* @method array findById(int $id) Return BlockVersion objects filtered by the id column
|
|
||||||
* @method array findByName(string $name) Return BlockVersion objects filtered by the name column
|
|
||||||
* @method array findByValue(string $value) Return BlockVersion objects filtered by the value column
|
|
||||||
* @method array findByClassKey(string $class_key) Return BlockVersion objects filtered by the class_key column
|
|
||||||
* @method array findByTemplate(string $template) Return BlockVersion objects filtered by the template column
|
|
||||||
* @method array findByModelId(int $model_id) Return BlockVersion objects filtered by the model_id column
|
|
||||||
* @method array findByCreatedAt(string $created_at) Return BlockVersion objects filtered by the created_at column
|
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return BlockVersion objects filtered by the updated_at column
|
|
||||||
* @method array findByVersion(int $version) Return BlockVersion objects filtered by the version column
|
|
||||||
* @method array findByVersionCreatedAt(string $version_created_at) Return BlockVersion objects filtered by the version_created_at column
|
|
||||||
* @method array findByVersionCreatedBy(string $version_created_by) Return BlockVersion objects filtered by the version_created_by column
|
|
||||||
* @method array findByModelIdVersion(int $model_id_version) Return BlockVersion objects filtered by the model_id_version column
|
|
||||||
*/
|
|
||||||
abstract class BaseBlockVersionQuery extends ModelCriteria
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Initializes internal state of BaseBlockVersionQuery object.
|
|
||||||
*
|
|
||||||
* @param string $dbName The dabase name
|
|
||||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
|
||||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
|
||||||
*/
|
|
||||||
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
|
|
||||||
{
|
|
||||||
if (null === $dbName) {
|
|
||||||
$dbName = 'default';
|
|
||||||
}
|
|
||||||
if (null === $modelName) {
|
|
||||||
$modelName = 'Trinity\\Bundle\\NewsletterBundle\\Model\\BlockVersion';
|
|
||||||
}
|
|
||||||
parent::__construct($dbName, $modelName, $modelAlias);
|
|
||||||
EventDispatcherProxy::trigger(array('construct','query.construct'), new QueryEvent($this));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new BlockVersionQuery object.
|
|
||||||
*
|
|
||||||
* @param string $modelAlias The alias of a model in the query
|
|
||||||
* @param BlockVersionQuery|Criteria $criteria Optional Criteria to build the query from
|
|
||||||
*
|
|
||||||
* @return BlockVersionQuery
|
|
||||||
*/
|
|
||||||
public static function create($modelAlias = null, $criteria = null)
|
|
||||||
{
|
|
||||||
if ($criteria instanceof BlockVersionQuery) {
|
|
||||||
return $criteria;
|
|
||||||
}
|
|
||||||
$query = new static(null, null, $modelAlias);
|
|
||||||
|
|
||||||
if ($criteria instanceof Criteria) {
|
|
||||||
$query->mergeWith($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find object by primary key.
|
|
||||||
* Propel uses the instance pool to skip the database if the object exists.
|
|
||||||
* Go fast if the query is untouched.
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* $obj = $c->findPk(array(12, 34), $con);
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
* <code>
|
|
||||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
|
||||||
* </code>
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
|
|
||||||
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByValue('fooValue'); // WHERE value = 'fooValue'
|
|
||||||
* $query->filterByValue('%fooValue%'); // WHERE value LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByClassKey('fooValue'); // WHERE class_key = 'fooValue'
|
|
||||||
* $query->filterByClassKey('%fooValue%'); // WHERE class_key LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByTemplate('fooValue'); // WHERE template = 'fooValue'
|
|
||||||
* $query->filterByTemplate('%fooValue%'); // WHERE template LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
|
||||||
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,915 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\om;
|
|
||||||
|
|
||||||
use \BasePeer;
|
|
||||||
use \Criteria;
|
|
||||||
use \PDO;
|
|
||||||
use \PDOStatement;
|
|
||||||
use \Propel;
|
|
||||||
use \PropelException;
|
|
||||||
use \PropelPDO;
|
|
||||||
use Glorpen\Propel\PropelBundle\Dispatcher\EventDispatcherProxy;
|
|
||||||
use Glorpen\Propel\PropelBundle\Events\DetectOMClassEvent;
|
|
||||||
use Glorpen\Propel\PropelBundle\Events\PeerEvent;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\BlockPeer;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Model;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\ModelPeer;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\ModelVersionPeer;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\map\ModelTableMap;
|
|
||||||
|
|
||||||
abstract class BaseModelPeer
|
|
||||||
{
|
|
||||||
|
|
||||||
/** the default database name for this class */
|
|
||||||
const DATABASE_NAME = 'default';
|
|
||||||
|
|
||||||
/** the table name for this class */
|
|
||||||
const TABLE_NAME = 'nws_model';
|
|
||||||
|
|
||||||
/** the related Propel class for this table */
|
|
||||||
const OM_CLASS = 'Trinity\\Bundle\\NewsletterBundle\\Model\\Model';
|
|
||||||
|
|
||||||
/** the related TableMap class for this table */
|
|
||||||
const TM_CLASS = 'Trinity\\Bundle\\NewsletterBundle\\Model\\map\\ModelTableMap';
|
|
||||||
|
|
||||||
/** The total number of columns. */
|
|
||||||
const NUM_COLUMNS = 9;
|
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
|
||||||
|
|
||||||
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
|
||||||
const NUM_HYDRATE_COLUMNS = 9;
|
|
||||||
|
|
||||||
/** the column name for the id field */
|
|
||||||
const ID = 'nws_model.id';
|
|
||||||
|
|
||||||
/** the column name for the name field */
|
|
||||||
const NAME = 'nws_model.name';
|
|
||||||
|
|
||||||
/** the column name for the template field */
|
|
||||||
const TEMPLATE = 'nws_model.template';
|
|
||||||
|
|
||||||
/** the column name for the class_key field */
|
|
||||||
const CLASS_KEY = 'nws_model.class_key';
|
|
||||||
|
|
||||||
/** the column name for the created_at field */
|
|
||||||
const CREATED_AT = 'nws_model.created_at';
|
|
||||||
|
|
||||||
/** the column name for the updated_at field */
|
|
||||||
const UPDATED_AT = 'nws_model.updated_at';
|
|
||||||
|
|
||||||
/** the column name for the version field */
|
|
||||||
const VERSION = 'nws_model.version';
|
|
||||||
|
|
||||||
/** the column name for the version_created_at field */
|
|
||||||
const VERSION_CREATED_AT = 'nws_model.version_created_at';
|
|
||||||
|
|
||||||
/** the column name for the version_created_by field */
|
|
||||||
const VERSION_CREATED_BY = 'nws_model.version_created_by';
|
|
||||||
|
|
||||||
/** The default string format for model objects of the related table **/
|
|
||||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An identity map to hold any loaded instances of Model objects.
|
|
||||||
* This must be public so that other peer classes can access this when hydrating from JOIN
|
|
||||||
* queries.
|
|
||||||
* @var array Model[]
|
|
||||||
*/
|
|
||||||
public static $instances = array();
|
|
||||||
|
|
||||||
|
|
||||||
// versionable behavior
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the versioning is enabled
|
|
||||||
*/
|
|
||||||
static $isVersioningEnabled = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* holds an array of fieldnames
|
|
||||||
*
|
|
||||||
* first dimension keys are the type constants
|
|
||||||
* e.g. ModelPeer::$fieldNames[ModelPeer::TYPE_PHPNAME][0] = 'Id'
|
|
||||||
*/
|
|
||||||
protected static $fieldNames = array (
|
|
||||||
BasePeer::TYPE_PHPNAME => 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.
|
|
||||||
* <code>
|
|
||||||
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
|
|
||||||
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
|
||||||
* </code>
|
|
||||||
* @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'));
|
|
|
@ -1,988 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\om;
|
|
||||||
|
|
||||||
use \Criteria;
|
|
||||||
use \Exception;
|
|
||||||
use \ModelCriteria;
|
|
||||||
use \ModelJoin;
|
|
||||||
use \PDO;
|
|
||||||
use \Propel;
|
|
||||||
use \PropelCollection;
|
|
||||||
use \PropelException;
|
|
||||||
use \PropelObjectCollection;
|
|
||||||
use \PropelPDO;
|
|
||||||
use Glorpen\Propel\PropelBundle\Dispatcher\EventDispatcherProxy;
|
|
||||||
use Glorpen\Propel\PropelBundle\Events\QueryEvent;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Block;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Model;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\ModelPeer;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\ModelQuery;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\ModelVersion;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Newsletter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method ModelQuery orderById($order = Criteria::ASC) Order by the id column
|
|
||||||
* @method ModelQuery orderByName($order = Criteria::ASC) Order by the name column
|
|
||||||
* @method ModelQuery orderByTemplate($order = Criteria::ASC) Order by the template column
|
|
||||||
* @method ModelQuery orderByClassKey($order = Criteria::ASC) Order by the class_key column
|
|
||||||
* @method ModelQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
|
||||||
* @method ModelQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
|
||||||
* @method ModelQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
|
||||||
* @method ModelQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
|
||||||
* @method ModelQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
|
||||||
*
|
|
||||||
* @method ModelQuery groupById() Group by the id column
|
|
||||||
* @method ModelQuery groupByName() Group by the name column
|
|
||||||
* @method ModelQuery groupByTemplate() Group by the template column
|
|
||||||
* @method ModelQuery groupByClassKey() Group by the class_key column
|
|
||||||
* @method ModelQuery groupByCreatedAt() Group by the created_at column
|
|
||||||
* @method ModelQuery groupByUpdatedAt() Group by the updated_at column
|
|
||||||
* @method ModelQuery groupByVersion() Group by the version column
|
|
||||||
* @method ModelQuery groupByVersionCreatedAt() Group by the version_created_at column
|
|
||||||
* @method ModelQuery groupByVersionCreatedBy() Group by the version_created_by column
|
|
||||||
*
|
|
||||||
* @method ModelQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
|
||||||
* @method ModelQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
|
||||||
* @method ModelQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
|
||||||
*
|
|
||||||
* @method ModelQuery leftJoinNewsletter($relationAlias = null) Adds a LEFT JOIN clause to the query using the Newsletter relation
|
|
||||||
* @method ModelQuery rightJoinNewsletter($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Newsletter relation
|
|
||||||
* @method ModelQuery innerJoinNewsletter($relationAlias = null) Adds a INNER JOIN clause to the query using the Newsletter relation
|
|
||||||
*
|
|
||||||
* @method ModelQuery leftJoinBlock($relationAlias = null) Adds a LEFT JOIN clause to the query using the Block relation
|
|
||||||
* @method ModelQuery rightJoinBlock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Block relation
|
|
||||||
* @method ModelQuery innerJoinBlock($relationAlias = null) Adds a INNER JOIN clause to the query using the Block relation
|
|
||||||
*
|
|
||||||
* @method ModelQuery leftJoinModelVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModelVersion relation
|
|
||||||
* @method ModelQuery rightJoinModelVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModelVersion relation
|
|
||||||
* @method ModelQuery innerJoinModelVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the ModelVersion relation
|
|
||||||
*
|
|
||||||
* @method Model findOne(PropelPDO $con = null) Return the first Model matching the query
|
|
||||||
* @method Model findOneOrCreate(PropelPDO $con = null) Return the first Model matching the query, or a new Model object populated from the query conditions when no match is found
|
|
||||||
*
|
|
||||||
* @method Model findOneByName(string $name) Return the first Model filtered by the name column
|
|
||||||
* @method Model findOneByTemplate(string $template) Return the first Model filtered by the template column
|
|
||||||
* @method Model findOneByClassKey(string $class_key) Return the first Model filtered by the class_key column
|
|
||||||
* @method Model findOneByCreatedAt(string $created_at) Return the first Model filtered by the created_at column
|
|
||||||
* @method Model findOneByUpdatedAt(string $updated_at) Return the first Model filtered by the updated_at column
|
|
||||||
* @method Model findOneByVersion(int $version) Return the first Model filtered by the version column
|
|
||||||
* @method Model findOneByVersionCreatedAt(string $version_created_at) Return the first Model filtered by the version_created_at column
|
|
||||||
* @method Model findOneByVersionCreatedBy(string $version_created_by) Return the first Model filtered by the version_created_by column
|
|
||||||
*
|
|
||||||
* @method array findById(int $id) Return Model objects filtered by the id column
|
|
||||||
* @method array findByName(string $name) Return Model objects filtered by the name column
|
|
||||||
* @method array findByTemplate(string $template) Return Model objects filtered by the template column
|
|
||||||
* @method array findByClassKey(string $class_key) Return Model objects filtered by the class_key column
|
|
||||||
* @method array findByCreatedAt(string $created_at) Return Model objects filtered by the created_at column
|
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return Model objects filtered by the updated_at column
|
|
||||||
* @method array findByVersion(int $version) Return Model objects filtered by the version column
|
|
||||||
* @method array findByVersionCreatedAt(string $version_created_at) Return Model objects filtered by the version_created_at column
|
|
||||||
* @method array findByVersionCreatedBy(string $version_created_by) Return Model objects filtered by the version_created_by column
|
|
||||||
*/
|
|
||||||
abstract class BaseModelQuery extends ModelCriteria
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Initializes internal state of BaseModelQuery object.
|
|
||||||
*
|
|
||||||
* @param string $dbName The dabase name
|
|
||||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
|
||||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
|
||||||
*/
|
|
||||||
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
|
|
||||||
{
|
|
||||||
if (null === $dbName) {
|
|
||||||
$dbName = 'default';
|
|
||||||
}
|
|
||||||
if (null === $modelName) {
|
|
||||||
$modelName = 'Trinity\\Bundle\\NewsletterBundle\\Model\\Model';
|
|
||||||
}
|
|
||||||
parent::__construct($dbName, $modelName, $modelAlias);
|
|
||||||
EventDispatcherProxy::trigger(array('construct','query.construct'), new QueryEvent($this));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new ModelQuery object.
|
|
||||||
*
|
|
||||||
* @param string $modelAlias The alias of a model in the query
|
|
||||||
* @param ModelQuery|Criteria $criteria Optional Criteria to build the query from
|
|
||||||
*
|
|
||||||
* @return ModelQuery
|
|
||||||
*/
|
|
||||||
public static function create($modelAlias = null, $criteria = null)
|
|
||||||
{
|
|
||||||
if ($criteria instanceof ModelQuery) {
|
|
||||||
return $criteria;
|
|
||||||
}
|
|
||||||
$query = new static(null, null, $modelAlias);
|
|
||||||
|
|
||||||
if ($criteria instanceof Criteria) {
|
|
||||||
$query->mergeWith($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find object by primary key.
|
|
||||||
* Propel uses the instance pool to skip the database if the object exists.
|
|
||||||
* Go fast if the query is untouched.
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* $obj = $c->findPk(12, $con);
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
* <code>
|
|
||||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
|
||||||
* </code>
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
|
|
||||||
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByTemplate('fooValue'); // WHERE template = 'fooValue'
|
|
||||||
* $query->filterByTemplate('%fooValue%'); // WHERE template LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByClassKey('fooValue'); // WHERE class_key = 'fooValue'
|
|
||||||
* $query->filterByClassKey('%fooValue%'); // WHERE class_key LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
|
||||||
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,941 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\om;
|
|
||||||
|
|
||||||
use \Criteria;
|
|
||||||
use \Exception;
|
|
||||||
use \ModelCriteria;
|
|
||||||
use \ModelJoin;
|
|
||||||
use \PDO;
|
|
||||||
use \Propel;
|
|
||||||
use \PropelCollection;
|
|
||||||
use \PropelException;
|
|
||||||
use \PropelObjectCollection;
|
|
||||||
use \PropelPDO;
|
|
||||||
use Glorpen\Propel\PropelBundle\Dispatcher\EventDispatcherProxy;
|
|
||||||
use Glorpen\Propel\PropelBundle\Events\QueryEvent;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Model;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\ModelVersion;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\ModelVersionPeer;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\ModelVersionQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method ModelVersionQuery orderById($order = Criteria::ASC) Order by the id column
|
|
||||||
* @method ModelVersionQuery orderByName($order = Criteria::ASC) Order by the name column
|
|
||||||
* @method ModelVersionQuery orderByTemplate($order = Criteria::ASC) Order by the template column
|
|
||||||
* @method ModelVersionQuery orderByClassKey($order = Criteria::ASC) Order by the class_key column
|
|
||||||
* @method ModelVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
|
||||||
* @method ModelVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
|
||||||
* @method ModelVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
|
||||||
* @method ModelVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
|
||||||
* @method ModelVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
|
||||||
* @method ModelVersionQuery orderByNwsBlockIds($order = Criteria::ASC) Order by the nws_block_ids column
|
|
||||||
* @method ModelVersionQuery orderByNwsBlockVersions($order = Criteria::ASC) Order by the nws_block_versions column
|
|
||||||
*
|
|
||||||
* @method ModelVersionQuery groupById() Group by the id column
|
|
||||||
* @method ModelVersionQuery groupByName() Group by the name column
|
|
||||||
* @method ModelVersionQuery groupByTemplate() Group by the template column
|
|
||||||
* @method ModelVersionQuery groupByClassKey() Group by the class_key column
|
|
||||||
* @method ModelVersionQuery groupByCreatedAt() Group by the created_at column
|
|
||||||
* @method ModelVersionQuery groupByUpdatedAt() Group by the updated_at column
|
|
||||||
* @method ModelVersionQuery groupByVersion() Group by the version column
|
|
||||||
* @method ModelVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
|
|
||||||
* @method ModelVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
|
|
||||||
* @method ModelVersionQuery groupByNwsBlockIds() Group by the nws_block_ids column
|
|
||||||
* @method ModelVersionQuery groupByNwsBlockVersions() Group by the nws_block_versions column
|
|
||||||
*
|
|
||||||
* @method ModelVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
|
||||||
* @method ModelVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
|
||||||
* @method ModelVersionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
|
||||||
*
|
|
||||||
* @method ModelVersionQuery leftJoinModel($relationAlias = null) Adds a LEFT JOIN clause to the query using the Model relation
|
|
||||||
* @method ModelVersionQuery rightJoinModel($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Model relation
|
|
||||||
* @method ModelVersionQuery innerJoinModel($relationAlias = null) Adds a INNER JOIN clause to the query using the Model relation
|
|
||||||
*
|
|
||||||
* @method ModelVersion findOne(PropelPDO $con = null) Return the first ModelVersion matching the query
|
|
||||||
* @method ModelVersion findOneOrCreate(PropelPDO $con = null) Return the first ModelVersion matching the query, or a new ModelVersion object populated from the query conditions when no match is found
|
|
||||||
*
|
|
||||||
* @method ModelVersion findOneById(int $id) Return the first ModelVersion filtered by the id column
|
|
||||||
* @method ModelVersion findOneByName(string $name) Return the first ModelVersion filtered by the name column
|
|
||||||
* @method ModelVersion findOneByTemplate(string $template) Return the first ModelVersion filtered by the template column
|
|
||||||
* @method ModelVersion findOneByClassKey(string $class_key) Return the first ModelVersion filtered by the class_key column
|
|
||||||
* @method ModelVersion findOneByCreatedAt(string $created_at) Return the first ModelVersion filtered by the created_at column
|
|
||||||
* @method ModelVersion findOneByUpdatedAt(string $updated_at) Return the first ModelVersion filtered by the updated_at column
|
|
||||||
* @method ModelVersion findOneByVersion(int $version) Return the first ModelVersion filtered by the version column
|
|
||||||
* @method ModelVersion findOneByVersionCreatedAt(string $version_created_at) Return the first ModelVersion filtered by the version_created_at column
|
|
||||||
* @method ModelVersion findOneByVersionCreatedBy(string $version_created_by) Return the first ModelVersion filtered by the version_created_by column
|
|
||||||
* @method ModelVersion findOneByNwsBlockIds(array $nws_block_ids) Return the first ModelVersion filtered by the nws_block_ids column
|
|
||||||
* @method ModelVersion findOneByNwsBlockVersions(array $nws_block_versions) Return the first ModelVersion filtered by the nws_block_versions column
|
|
||||||
*
|
|
||||||
* @method array findById(int $id) Return ModelVersion objects filtered by the id column
|
|
||||||
* @method array findByName(string $name) Return ModelVersion objects filtered by the name column
|
|
||||||
* @method array findByTemplate(string $template) Return ModelVersion objects filtered by the template column
|
|
||||||
* @method array findByClassKey(string $class_key) Return ModelVersion objects filtered by the class_key column
|
|
||||||
* @method array findByCreatedAt(string $created_at) Return ModelVersion objects filtered by the created_at column
|
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return ModelVersion objects filtered by the updated_at column
|
|
||||||
* @method array findByVersion(int $version) Return ModelVersion objects filtered by the version column
|
|
||||||
* @method array findByVersionCreatedAt(string $version_created_at) Return ModelVersion objects filtered by the version_created_at column
|
|
||||||
* @method array findByVersionCreatedBy(string $version_created_by) Return ModelVersion objects filtered by the version_created_by column
|
|
||||||
* @method array findByNwsBlockIds(array $nws_block_ids) Return ModelVersion objects filtered by the nws_block_ids column
|
|
||||||
* @method array findByNwsBlockVersions(array $nws_block_versions) Return ModelVersion objects filtered by the nws_block_versions column
|
|
||||||
*/
|
|
||||||
abstract class BaseModelVersionQuery extends ModelCriteria
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Initializes internal state of BaseModelVersionQuery object.
|
|
||||||
*
|
|
||||||
* @param string $dbName The dabase name
|
|
||||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
|
||||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
|
||||||
*/
|
|
||||||
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
|
|
||||||
{
|
|
||||||
if (null === $dbName) {
|
|
||||||
$dbName = 'default';
|
|
||||||
}
|
|
||||||
if (null === $modelName) {
|
|
||||||
$modelName = 'Trinity\\Bundle\\NewsletterBundle\\Model\\ModelVersion';
|
|
||||||
}
|
|
||||||
parent::__construct($dbName, $modelName, $modelAlias);
|
|
||||||
EventDispatcherProxy::trigger(array('construct','query.construct'), new QueryEvent($this));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new ModelVersionQuery object.
|
|
||||||
*
|
|
||||||
* @param string $modelAlias The alias of a model in the query
|
|
||||||
* @param ModelVersionQuery|Criteria $criteria Optional Criteria to build the query from
|
|
||||||
*
|
|
||||||
* @return ModelVersionQuery
|
|
||||||
*/
|
|
||||||
public static function create($modelAlias = null, $criteria = null)
|
|
||||||
{
|
|
||||||
if ($criteria instanceof ModelVersionQuery) {
|
|
||||||
return $criteria;
|
|
||||||
}
|
|
||||||
$query = new static(null, null, $modelAlias);
|
|
||||||
|
|
||||||
if ($criteria instanceof Criteria) {
|
|
||||||
$query->mergeWith($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find object by primary key.
|
|
||||||
* Propel uses the instance pool to skip the database if the object exists.
|
|
||||||
* Go fast if the query is untouched.
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* $obj = $c->findPk(array(12, 34), $con);
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
* <code>
|
|
||||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
|
||||||
* </code>
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
|
|
||||||
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByTemplate('fooValue'); // WHERE template = 'fooValue'
|
|
||||||
* $query->filterByTemplate('%fooValue%'); // WHERE template LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByClassKey('fooValue'); // WHERE class_key = 'fooValue'
|
|
||||||
* $query->filterByClassKey('%fooValue%'); // WHERE class_key LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
|
||||||
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,931 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\om;
|
|
||||||
|
|
||||||
use \Criteria;
|
|
||||||
use \Exception;
|
|
||||||
use \ModelCriteria;
|
|
||||||
use \ModelJoin;
|
|
||||||
use \PDO;
|
|
||||||
use \Propel;
|
|
||||||
use \PropelCollection;
|
|
||||||
use \PropelException;
|
|
||||||
use \PropelObjectCollection;
|
|
||||||
use \PropelPDO;
|
|
||||||
use FOS\UserBundle\Propel\Group;
|
|
||||||
use Glorpen\Propel\PropelBundle\Dispatcher\EventDispatcherProxy;
|
|
||||||
use Glorpen\Propel\PropelBundle\Events\QueryEvent;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Model;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Newsletter;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\NewsletterPeer;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\NewsletterQuery;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\NewsletterRecipients;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method NewsletterQuery orderById($order = Criteria::ASC) Order by the id column
|
|
||||||
* @method NewsletterQuery orderByName($order = Criteria::ASC) Order by the name column
|
|
||||||
* @method NewsletterQuery orderBySenderName($order = Criteria::ASC) Order by the sender_name column
|
|
||||||
* @method NewsletterQuery orderBySenderEmail($order = Criteria::ASC) Order by the sender_email column
|
|
||||||
* @method NewsletterQuery orderByModelId($order = Criteria::ASC) Order by the model_id column
|
|
||||||
* @method NewsletterQuery orderByEmailListing($order = Criteria::ASC) Order by the email_listing column
|
|
||||||
* @method NewsletterQuery orderBySentAt($order = Criteria::ASC) Order by the sent_at column
|
|
||||||
* @method NewsletterQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
|
||||||
* @method NewsletterQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
|
||||||
*
|
|
||||||
* @method NewsletterQuery groupById() Group by the id column
|
|
||||||
* @method NewsletterQuery groupByName() Group by the name column
|
|
||||||
* @method NewsletterQuery groupBySenderName() Group by the sender_name column
|
|
||||||
* @method NewsletterQuery groupBySenderEmail() Group by the sender_email column
|
|
||||||
* @method NewsletterQuery groupByModelId() Group by the model_id column
|
|
||||||
* @method NewsletterQuery groupByEmailListing() Group by the email_listing column
|
|
||||||
* @method NewsletterQuery groupBySentAt() Group by the sent_at column
|
|
||||||
* @method NewsletterQuery groupByCreatedAt() Group by the created_at column
|
|
||||||
* @method NewsletterQuery groupByUpdatedAt() Group by the updated_at column
|
|
||||||
*
|
|
||||||
* @method NewsletterQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
|
||||||
* @method NewsletterQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
|
||||||
* @method NewsletterQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
|
||||||
*
|
|
||||||
* @method NewsletterQuery leftJoinModel($relationAlias = null) Adds a LEFT JOIN clause to the query using the Model relation
|
|
||||||
* @method NewsletterQuery rightJoinModel($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Model relation
|
|
||||||
* @method NewsletterQuery innerJoinModel($relationAlias = null) Adds a INNER JOIN clause to the query using the Model relation
|
|
||||||
*
|
|
||||||
* @method NewsletterQuery leftJoinNewsletterRecipients($relationAlias = null) Adds a LEFT JOIN clause to the query using the NewsletterRecipients relation
|
|
||||||
* @method NewsletterQuery rightJoinNewsletterRecipients($relationAlias = null) Adds a RIGHT JOIN clause to the query using the NewsletterRecipients relation
|
|
||||||
* @method NewsletterQuery innerJoinNewsletterRecipients($relationAlias = null) Adds a INNER JOIN clause to the query using the NewsletterRecipients relation
|
|
||||||
*
|
|
||||||
* @method Newsletter findOne(PropelPDO $con = null) Return the first Newsletter matching the query
|
|
||||||
* @method Newsletter findOneOrCreate(PropelPDO $con = null) Return the first Newsletter matching the query, or a new Newsletter object populated from the query conditions when no match is found
|
|
||||||
*
|
|
||||||
* @method Newsletter findOneByName(string $name) Return the first Newsletter filtered by the name column
|
|
||||||
* @method Newsletter findOneBySenderName(string $sender_name) Return the first Newsletter filtered by the sender_name column
|
|
||||||
* @method Newsletter findOneBySenderEmail(string $sender_email) Return the first Newsletter filtered by the sender_email column
|
|
||||||
* @method Newsletter findOneByModelId(int $model_id) Return the first Newsletter filtered by the model_id column
|
|
||||||
* @method Newsletter findOneByEmailListing(string $email_listing) Return the first Newsletter filtered by the email_listing column
|
|
||||||
* @method Newsletter findOneBySentAt(string $sent_at) Return the first Newsletter filtered by the sent_at column
|
|
||||||
* @method Newsletter findOneByCreatedAt(string $created_at) Return the first Newsletter filtered by the created_at column
|
|
||||||
* @method Newsletter findOneByUpdatedAt(string $updated_at) Return the first Newsletter filtered by the updated_at column
|
|
||||||
*
|
|
||||||
* @method array findById(int $id) Return Newsletter objects filtered by the id column
|
|
||||||
* @method array findByName(string $name) Return Newsletter objects filtered by the name column
|
|
||||||
* @method array findBySenderName(string $sender_name) Return Newsletter objects filtered by the sender_name column
|
|
||||||
* @method array findBySenderEmail(string $sender_email) Return Newsletter objects filtered by the sender_email column
|
|
||||||
* @method array findByModelId(int $model_id) Return Newsletter objects filtered by the model_id column
|
|
||||||
* @method array findByEmailListing(string $email_listing) Return Newsletter objects filtered by the email_listing column
|
|
||||||
* @method array findBySentAt(string $sent_at) Return Newsletter objects filtered by the sent_at column
|
|
||||||
* @method array findByCreatedAt(string $created_at) Return Newsletter objects filtered by the created_at column
|
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return Newsletter objects filtered by the updated_at column
|
|
||||||
*/
|
|
||||||
abstract class BaseNewsletterQuery extends ModelCriteria
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Initializes internal state of BaseNewsletterQuery object.
|
|
||||||
*
|
|
||||||
* @param string $dbName The dabase name
|
|
||||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
|
||||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
|
||||||
*/
|
|
||||||
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
|
|
||||||
{
|
|
||||||
if (null === $dbName) {
|
|
||||||
$dbName = 'default';
|
|
||||||
}
|
|
||||||
if (null === $modelName) {
|
|
||||||
$modelName = 'Trinity\\Bundle\\NewsletterBundle\\Model\\Newsletter';
|
|
||||||
}
|
|
||||||
parent::__construct($dbName, $modelName, $modelAlias);
|
|
||||||
EventDispatcherProxy::trigger(array('construct','query.construct'), new QueryEvent($this));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new NewsletterQuery object.
|
|
||||||
*
|
|
||||||
* @param string $modelAlias The alias of a model in the query
|
|
||||||
* @param NewsletterQuery|Criteria $criteria Optional Criteria to build the query from
|
|
||||||
*
|
|
||||||
* @return NewsletterQuery
|
|
||||||
*/
|
|
||||||
public static function create($modelAlias = null, $criteria = null)
|
|
||||||
{
|
|
||||||
if ($criteria instanceof NewsletterQuery) {
|
|
||||||
return $criteria;
|
|
||||||
}
|
|
||||||
$query = new static(null, null, $modelAlias);
|
|
||||||
|
|
||||||
if ($criteria instanceof Criteria) {
|
|
||||||
$query->mergeWith($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find object by primary key.
|
|
||||||
* Propel uses the instance pool to skip the database if the object exists.
|
|
||||||
* Go fast if the query is untouched.
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* $obj = $c->findPk(12, $con);
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
* <code>
|
|
||||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
|
||||||
* </code>
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
|
|
||||||
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterBySenderName('fooValue'); // WHERE sender_name = 'fooValue'
|
|
||||||
* $query->filterBySenderName('%fooValue%'); // WHERE sender_name LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterBySenderEmail('fooValue'); // WHERE sender_email = 'fooValue'
|
|
||||||
* $query->filterBySenderEmail('%fooValue%'); // WHERE sender_email LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByEmailListing('fooValue'); // WHERE email_listing = 'fooValue'
|
|
||||||
* $query->filterByEmailListing('%fooValue%'); // WHERE email_listing LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,581 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Trinity\Bundle\NewsletterBundle\Model\om;
|
|
||||||
|
|
||||||
use \Criteria;
|
|
||||||
use \Exception;
|
|
||||||
use \ModelCriteria;
|
|
||||||
use \ModelJoin;
|
|
||||||
use \PDO;
|
|
||||||
use \Propel;
|
|
||||||
use \PropelCollection;
|
|
||||||
use \PropelException;
|
|
||||||
use \PropelObjectCollection;
|
|
||||||
use \PropelPDO;
|
|
||||||
use FOS\UserBundle\Propel\Group;
|
|
||||||
use Glorpen\Propel\PropelBundle\Dispatcher\EventDispatcherProxy;
|
|
||||||
use Glorpen\Propel\PropelBundle\Events\QueryEvent;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\Newsletter;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\NewsletterRecipients;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\NewsletterRecipientsPeer;
|
|
||||||
use Trinity\Bundle\NewsletterBundle\Model\NewsletterRecipientsQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method NewsletterRecipientsQuery orderByNwsNewsletterId($order = Criteria::ASC) Order by the nws_newsletter_id column
|
|
||||||
* @method NewsletterRecipientsQuery orderByFosGroupId($order = Criteria::ASC) Order by the fos_group_id column
|
|
||||||
*
|
|
||||||
* @method NewsletterRecipientsQuery groupByNwsNewsletterId() Group by the nws_newsletter_id column
|
|
||||||
* @method NewsletterRecipientsQuery groupByFosGroupId() Group by the fos_group_id column
|
|
||||||
*
|
|
||||||
* @method NewsletterRecipientsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
|
||||||
* @method NewsletterRecipientsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
|
||||||
* @method NewsletterRecipientsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
|
||||||
*
|
|
||||||
* @method NewsletterRecipientsQuery leftJoinNewsletter($relationAlias = null) Adds a LEFT JOIN clause to the query using the Newsletter relation
|
|
||||||
* @method NewsletterRecipientsQuery rightJoinNewsletter($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Newsletter relation
|
|
||||||
* @method NewsletterRecipientsQuery innerJoinNewsletter($relationAlias = null) Adds a INNER JOIN clause to the query using the Newsletter relation
|
|
||||||
*
|
|
||||||
* @method NewsletterRecipientsQuery leftJoinGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the Group relation
|
|
||||||
* @method NewsletterRecipientsQuery rightJoinGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Group relation
|
|
||||||
* @method NewsletterRecipientsQuery innerJoinGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the Group relation
|
|
||||||
*
|
|
||||||
* @method NewsletterRecipients findOne(PropelPDO $con = null) Return the first NewsletterRecipients matching the query
|
|
||||||
* @method NewsletterRecipients findOneOrCreate(PropelPDO $con = null) Return the first NewsletterRecipients matching the query, or a new NewsletterRecipients object populated from the query conditions when no match is found
|
|
||||||
*
|
|
||||||
* @method NewsletterRecipients findOneByNwsNewsletterId(int $nws_newsletter_id) Return the first NewsletterRecipients filtered by the nws_newsletter_id column
|
|
||||||
* @method NewsletterRecipients findOneByFosGroupId(int $fos_group_id) Return the first NewsletterRecipients filtered by the fos_group_id column
|
|
||||||
*
|
|
||||||
* @method array findByNwsNewsletterId(int $nws_newsletter_id) Return NewsletterRecipients objects filtered by the nws_newsletter_id column
|
|
||||||
* @method array findByFosGroupId(int $fos_group_id) Return NewsletterRecipients objects filtered by the fos_group_id column
|
|
||||||
*/
|
|
||||||
abstract class BaseNewsletterRecipientsQuery extends ModelCriteria
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Initializes internal state of BaseNewsletterRecipientsQuery object.
|
|
||||||
*
|
|
||||||
* @param string $dbName The dabase name
|
|
||||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
|
||||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
|
||||||
*/
|
|
||||||
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
|
|
||||||
{
|
|
||||||
if (null === $dbName) {
|
|
||||||
$dbName = 'default';
|
|
||||||
}
|
|
||||||
if (null === $modelName) {
|
|
||||||
$modelName = 'Trinity\\Bundle\\NewsletterBundle\\Model\\NewsletterRecipients';
|
|
||||||
}
|
|
||||||
parent::__construct($dbName, $modelName, $modelAlias);
|
|
||||||
EventDispatcherProxy::trigger(array('construct','query.construct'), new QueryEvent($this));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new NewsletterRecipientsQuery object.
|
|
||||||
*
|
|
||||||
* @param string $modelAlias The alias of a model in the query
|
|
||||||
* @param NewsletterRecipientsQuery|Criteria $criteria Optional Criteria to build the query from
|
|
||||||
*
|
|
||||||
* @return NewsletterRecipientsQuery
|
|
||||||
*/
|
|
||||||
public static function create($modelAlias = null, $criteria = null)
|
|
||||||
{
|
|
||||||
if ($criteria instanceof NewsletterRecipientsQuery) {
|
|
||||||
return $criteria;
|
|
||||||
}
|
|
||||||
$query = new static(null, null, $modelAlias);
|
|
||||||
|
|
||||||
if ($criteria instanceof Criteria) {
|
|
||||||
$query->mergeWith($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find object by primary key.
|
|
||||||
* Propel uses the instance pool to skip the database if the object exists.
|
|
||||||
* Go fast if the query is untouched.
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* $obj = $c->findPk(array(12, 34), $con);
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
* <code>
|
|
||||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
|
||||||
* </code>
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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:
|
|
||||||
* <code>
|
|
||||||
* $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
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,7 @@
|
||||||
<column name="log_content_render" type="longvarchar" required="true" />
|
<column name="log_content_render" type="longvarchar" required="true" />
|
||||||
<column name="is_read" type="boolean" defaultValue="false" />
|
<column name="is_read" type="boolean" defaultValue="false" />
|
||||||
<column name="user_id" type="integer" />
|
<column name="user_id" type="integer" />
|
||||||
<column name="template_id" type="varchar" size="255" />
|
<column name="template_id" type="integer" />
|
||||||
<foreign-key name="fk_notification_1" foreignTable="fos_user">
|
<foreign-key name="fk_notification_1" foreignTable="fos_user">
|
||||||
<reference local="user_id" foreign="id" />
|
<reference local="user_id" foreign="id" />
|
||||||
</foreign-key>
|
</foreign-key>
|
||||||
|
@ -26,4 +26,4 @@
|
||||||
<unique-column name="reference" size="255"/>
|
<unique-column name="reference" size="255"/>
|
||||||
</unique>
|
</unique>
|
||||||
</table>
|
</table>
|
||||||
</database>
|
</database>
|
||||||
|
|
|
@ -4,17 +4,48 @@ namespace Trinity\Bundle\UserBundle\Flash;
|
||||||
|
|
||||||
abstract class Flash
|
abstract class Flash
|
||||||
{
|
{
|
||||||
protected $message = null;
|
protected $message = null;
|
||||||
|
|
||||||
public function __construct($message)
|
protected $options = array();
|
||||||
{
|
|
||||||
$this->message = $message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMessage()
|
public function __construct($message, array $options = array())
|
||||||
{
|
{
|
||||||
return $this->message;
|
$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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,29 +47,21 @@ class Config
|
||||||
|
|
||||||
foreach ($config['fieldsets'] as $fieldset) {
|
foreach ($config['fieldsets'] as $fieldset) {
|
||||||
if (!is_null($locale) && isset($fieldset['tabs'])) {
|
if (!is_null($locale) && isset($fieldset['tabs'])) {
|
||||||
if (!isset($fieldset['tabs'][$locale])) {
|
if (isset($fieldset['tabs'][$locale])) {
|
||||||
return $default;
|
foreach ($fieldset['tabs'][$locale]['vars'] as $var) {
|
||||||
}
|
if (isset($var['key'], $var['value'])) {
|
||||||
|
if ($var['key'] === $key) {
|
||||||
foreach ($fieldset['tabs'][$locale]['vars'] as $var) {
|
return $var['value'];
|
||||||
if (!isset($var['key'], $var['value'])) {
|
}
|
||||||
return $default;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($var['key'] === $key) {
|
|
||||||
return $var['value'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (empty($fieldset['vars'])) {
|
} elseif (!empty($fieldset['vars'])) {
|
||||||
return $default;
|
|
||||||
} else {
|
|
||||||
foreach ($fieldset['vars'] as $var) {
|
foreach ($fieldset['vars'] as $var) {
|
||||||
if (!isset($var['key'], $var['value'])) {
|
if (isset($var['key'], $var['value'])) {
|
||||||
return $default;
|
if ($var['key'] === $key) {
|
||||||
}
|
return $var['value'];
|
||||||
|
}
|
||||||
if ($var['key'] === $key) {
|
|
||||||
return $var['value'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue