721 lines
28 KiB
Plaintext
721 lines
28 KiB
Plaintext
<?php
|
|
|
|
namespace Trinity\Bundle\SlideshowBundle\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\ContentManagerBundle\Model\Block;
|
|
use Trinity\Bundle\SlideshowBundle\Model\SlideshowItem;
|
|
use Trinity\Bundle\SlideshowBundle\Model\SlideshowItemPeer;
|
|
use Trinity\Bundle\SlideshowBundle\Model\SlideshowItemQuery;
|
|
|
|
/**
|
|
* @method SlideshowItemQuery orderById($order = Criteria::ASC) Order by the id column
|
|
* @method SlideshowItemQuery orderByUid($order = Criteria::ASC) Order by the uid column
|
|
* @method SlideshowItemQuery orderByCmsBlockId($order = Criteria::ASC) Order by the cms_block_id column
|
|
* @method SlideshowItemQuery orderByTitle($order = Criteria::ASC) Order by the title column
|
|
* @method SlideshowItemQuery orderByRank($order = Criteria::ASC) Order by the rank column
|
|
* @method SlideshowItemQuery orderByPicture($order = Criteria::ASC) Order by the picture column
|
|
* @method SlideshowItemQuery orderByContent($order = Criteria::ASC) Order by the content column
|
|
* @method SlideshowItemQuery orderByLink($order = Criteria::ASC) Order by the link column
|
|
*
|
|
* @method SlideshowItemQuery groupById() Group by the id column
|
|
* @method SlideshowItemQuery groupByUid() Group by the uid column
|
|
* @method SlideshowItemQuery groupByCmsBlockId() Group by the cms_block_id column
|
|
* @method SlideshowItemQuery groupByTitle() Group by the title column
|
|
* @method SlideshowItemQuery groupByRank() Group by the rank column
|
|
* @method SlideshowItemQuery groupByPicture() Group by the picture column
|
|
* @method SlideshowItemQuery groupByContent() Group by the content column
|
|
* @method SlideshowItemQuery groupByLink() Group by the link column
|
|
*
|
|
* @method SlideshowItemQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
|
* @method SlideshowItemQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
|
* @method SlideshowItemQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
|
*
|
|
* @method SlideshowItemQuery leftJoinBlock($relationAlias = null) Adds a LEFT JOIN clause to the query using the Block relation
|
|
* @method SlideshowItemQuery rightJoinBlock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Block relation
|
|
* @method SlideshowItemQuery innerJoinBlock($relationAlias = null) Adds a INNER JOIN clause to the query using the Block relation
|
|
*
|
|
* @method SlideshowItem findOne(PropelPDO $con = null) Return the first SlideshowItem matching the query
|
|
* @method SlideshowItem findOneOrCreate(PropelPDO $con = null) Return the first SlideshowItem matching the query, or a new SlideshowItem object populated from the query conditions when no match is found
|
|
*
|
|
* @method SlideshowItem findOneByUid(int $uid) Return the first SlideshowItem filtered by the uid column
|
|
* @method SlideshowItem findOneByCmsBlockId(int $cms_block_id) Return the first SlideshowItem filtered by the cms_block_id column
|
|
* @method SlideshowItem findOneByTitle(string $title) Return the first SlideshowItem filtered by the title column
|
|
* @method SlideshowItem findOneByRank(int $rank) Return the first SlideshowItem filtered by the rank column
|
|
* @method SlideshowItem findOneByPicture(string $picture) Return the first SlideshowItem filtered by the picture column
|
|
* @method SlideshowItem findOneByContent(string $content) Return the first SlideshowItem filtered by the content column
|
|
* @method SlideshowItem findOneByLink(string $link) Return the first SlideshowItem filtered by the link column
|
|
*
|
|
* @method array findById(int $id) Return SlideshowItem objects filtered by the id column
|
|
* @method array findByUid(int $uid) Return SlideshowItem objects filtered by the uid column
|
|
* @method array findByCmsBlockId(int $cms_block_id) Return SlideshowItem objects filtered by the cms_block_id column
|
|
* @method array findByTitle(string $title) Return SlideshowItem objects filtered by the title column
|
|
* @method array findByRank(int $rank) Return SlideshowItem objects filtered by the rank column
|
|
* @method array findByPicture(string $picture) Return SlideshowItem objects filtered by the picture column
|
|
* @method array findByContent(string $content) Return SlideshowItem objects filtered by the content column
|
|
* @method array findByLink(string $link) Return SlideshowItem objects filtered by the link column
|
|
*/
|
|
abstract class BaseSlideshowItemQuery extends ModelCriteria
|
|
{
|
|
/**
|
|
* Initializes internal state of BaseSlideshowItemQuery 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\\SlideshowBundle\\Model\\SlideshowItem';
|
|
}
|
|
parent::__construct($dbName, $modelName, $modelAlias);
|
|
EventDispatcherProxy::trigger(array('construct','query.construct'), new QueryEvent($this));
|
|
}
|
|
|
|
/**
|
|
* Returns a new SlideshowItemQuery object.
|
|
*
|
|
* @param string $modelAlias The alias of a model in the query
|
|
* @param SlideshowItemQuery|Criteria $criteria Optional Criteria to build the query from
|
|
*
|
|
* @return SlideshowItemQuery
|
|
*/
|
|
public static function create($modelAlias = null, $criteria = null)
|
|
{
|
|
if ($criteria instanceof SlideshowItemQuery) {
|
|
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 SlideshowItem|SlideshowItem[]|mixed the result, formatted by the current formatter
|
|
*/
|
|
public function findPk($key, $con = null)
|
|
{
|
|
if ($key === null) {
|
|
return null;
|
|
}
|
|
if ((null !== ($obj = SlideshowItemPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
|
// the object is already in the instance pool
|
|
return $obj;
|
|
}
|
|
if ($con === null) {
|
|
$con = Propel::getConnection(SlideshowItemPeer::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 SlideshowItem 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 SlideshowItem A model object, or null if the key is not found
|
|
* @throws PropelException
|
|
*/
|
|
protected function findPkSimple($key, $con)
|
|
{
|
|
$sql = 'SELECT `id`, `uid`, `cms_block_id`, `title`, `rank`, `picture`, `content`, `link` FROM `slideshow_item` 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 = SlideshowItemPeer::getOMClass();
|
|
$obj = new $cls;
|
|
$obj->hydrate($row);
|
|
SlideshowItemPeer::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 SlideshowItem|SlideshowItem[]|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|SlideshowItem[]|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 SlideshowItemQuery The current query, for fluid interface
|
|
*/
|
|
public function filterByPrimaryKey($key)
|
|
{
|
|
|
|
return $this->addUsingAlias(SlideshowItemPeer::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 SlideshowItemQuery The current query, for fluid interface
|
|
*/
|
|
public function filterByPrimaryKeys($keys)
|
|
{
|
|
|
|
return $this->addUsingAlias(SlideshowItemPeer::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 SlideshowItemQuery 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(SlideshowItemPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
|
|
$useMinMax = true;
|
|
}
|
|
if (isset($id['max'])) {
|
|
$this->addUsingAlias(SlideshowItemPeer::ID, $id['max'], Criteria::LESS_EQUAL);
|
|
$useMinMax = true;
|
|
}
|
|
if ($useMinMax) {
|
|
return $this;
|
|
}
|
|
if (null === $comparison) {
|
|
$comparison = Criteria::IN;
|
|
}
|
|
}
|
|
|
|
return $this->addUsingAlias(SlideshowItemPeer::ID, $id, $comparison);
|
|
}
|
|
|
|
/**
|
|
* Filter the query on the uid column
|
|
*
|
|
* Example usage:
|
|
* <code>
|
|
* $query->filterByUid(1234); // WHERE uid = 1234
|
|
* $query->filterByUid(array(12, 34)); // WHERE uid IN (12, 34)
|
|
* $query->filterByUid(array('min' => 12)); // WHERE uid >= 12
|
|
* $query->filterByUid(array('max' => 12)); // WHERE uid <= 12
|
|
* </code>
|
|
*
|
|
* @param mixed $uid 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 SlideshowItemQuery The current query, for fluid interface
|
|
*/
|
|
public function filterByUid($uid = null, $comparison = null)
|
|
{
|
|
if (is_array($uid)) {
|
|
$useMinMax = false;
|
|
if (isset($uid['min'])) {
|
|
$this->addUsingAlias(SlideshowItemPeer::UID, $uid['min'], Criteria::GREATER_EQUAL);
|
|
$useMinMax = true;
|
|
}
|
|
if (isset($uid['max'])) {
|
|
$this->addUsingAlias(SlideshowItemPeer::UID, $uid['max'], Criteria::LESS_EQUAL);
|
|
$useMinMax = true;
|
|
}
|
|
if ($useMinMax) {
|
|
return $this;
|
|
}
|
|
if (null === $comparison) {
|
|
$comparison = Criteria::IN;
|
|
}
|
|
}
|
|
|
|
return $this->addUsingAlias(SlideshowItemPeer::UID, $uid, $comparison);
|
|
}
|
|
|
|
/**
|
|
* Filter the query on the cms_block_id column
|
|
*
|
|
* Example usage:
|
|
* <code>
|
|
* $query->filterByCmsBlockId(1234); // WHERE cms_block_id = 1234
|
|
* $query->filterByCmsBlockId(array(12, 34)); // WHERE cms_block_id IN (12, 34)
|
|
* $query->filterByCmsBlockId(array('min' => 12)); // WHERE cms_block_id >= 12
|
|
* $query->filterByCmsBlockId(array('max' => 12)); // WHERE cms_block_id <= 12
|
|
* </code>
|
|
*
|
|
* @see filterByBlock()
|
|
*
|
|
* @param mixed $cmsBlockId 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 SlideshowItemQuery The current query, for fluid interface
|
|
*/
|
|
public function filterByCmsBlockId($cmsBlockId = null, $comparison = null)
|
|
{
|
|
if (is_array($cmsBlockId)) {
|
|
$useMinMax = false;
|
|
if (isset($cmsBlockId['min'])) {
|
|
$this->addUsingAlias(SlideshowItemPeer::CMS_BLOCK_ID, $cmsBlockId['min'], Criteria::GREATER_EQUAL);
|
|
$useMinMax = true;
|
|
}
|
|
if (isset($cmsBlockId['max'])) {
|
|
$this->addUsingAlias(SlideshowItemPeer::CMS_BLOCK_ID, $cmsBlockId['max'], Criteria::LESS_EQUAL);
|
|
$useMinMax = true;
|
|
}
|
|
if ($useMinMax) {
|
|
return $this;
|
|
}
|
|
if (null === $comparison) {
|
|
$comparison = Criteria::IN;
|
|
}
|
|
}
|
|
|
|
return $this->addUsingAlias(SlideshowItemPeer::CMS_BLOCK_ID, $cmsBlockId, $comparison);
|
|
}
|
|
|
|
/**
|
|
* Filter the query on the title column
|
|
*
|
|
* Example usage:
|
|
* <code>
|
|
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
|
|
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
|
|
* </code>
|
|
*
|
|
* @param string $title The value to use as filter.
|
|
* Accepts wildcards (* and % trigger a LIKE)
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
*
|
|
* @return SlideshowItemQuery The current query, for fluid interface
|
|
*/
|
|
public function filterByTitle($title = null, $comparison = null)
|
|
{
|
|
if (null === $comparison) {
|
|
if (is_array($title)) {
|
|
$comparison = Criteria::IN;
|
|
} elseif (preg_match('/[\%\*]/', $title)) {
|
|
$title = str_replace('*', '%', $title);
|
|
$comparison = Criteria::LIKE;
|
|
}
|
|
}
|
|
|
|
return $this->addUsingAlias(SlideshowItemPeer::TITLE, $title, $comparison);
|
|
}
|
|
|
|
/**
|
|
* Filter the query on the rank column
|
|
*
|
|
* Example usage:
|
|
* <code>
|
|
* $query->filterByRank(1234); // WHERE rank = 1234
|
|
* $query->filterByRank(array(12, 34)); // WHERE rank IN (12, 34)
|
|
* $query->filterByRank(array('min' => 12)); // WHERE rank >= 12
|
|
* $query->filterByRank(array('max' => 12)); // WHERE rank <= 12
|
|
* </code>
|
|
*
|
|
* @param mixed $rank 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 SlideshowItemQuery The current query, for fluid interface
|
|
*/
|
|
public function filterByRank($rank = null, $comparison = null)
|
|
{
|
|
if (is_array($rank)) {
|
|
$useMinMax = false;
|
|
if (isset($rank['min'])) {
|
|
$this->addUsingAlias(SlideshowItemPeer::RANK, $rank['min'], Criteria::GREATER_EQUAL);
|
|
$useMinMax = true;
|
|
}
|
|
if (isset($rank['max'])) {
|
|
$this->addUsingAlias(SlideshowItemPeer::RANK, $rank['max'], Criteria::LESS_EQUAL);
|
|
$useMinMax = true;
|
|
}
|
|
if ($useMinMax) {
|
|
return $this;
|
|
}
|
|
if (null === $comparison) {
|
|
$comparison = Criteria::IN;
|
|
}
|
|
}
|
|
|
|
return $this->addUsingAlias(SlideshowItemPeer::RANK, $rank, $comparison);
|
|
}
|
|
|
|
/**
|
|
* Filter the query on the picture column
|
|
*
|
|
* Example usage:
|
|
* <code>
|
|
* $query->filterByPicture('fooValue'); // WHERE picture = 'fooValue'
|
|
* $query->filterByPicture('%fooValue%'); // WHERE picture LIKE '%fooValue%'
|
|
* </code>
|
|
*
|
|
* @param string $picture 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 SlideshowItemQuery The current query, for fluid interface
|
|
*/
|
|
public function filterByPicture($picture = null, $comparison = null)
|
|
{
|
|
if (null === $comparison) {
|
|
if (is_array($picture)) {
|
|
$comparison = Criteria::IN;
|
|
} elseif (preg_match('/[\%\*]/', $picture)) {
|
|
$picture = str_replace('*', '%', $picture);
|
|
$comparison = Criteria::LIKE;
|
|
}
|
|
}
|
|
|
|
return $this->addUsingAlias(SlideshowItemPeer::PICTURE, $picture, $comparison);
|
|
}
|
|
|
|
/**
|
|
* Filter the query on the content column
|
|
*
|
|
* Example usage:
|
|
* <code>
|
|
* $query->filterByContent('fooValue'); // WHERE content = 'fooValue'
|
|
* $query->filterByContent('%fooValue%'); // WHERE content LIKE '%fooValue%'
|
|
* </code>
|
|
*
|
|
* @param string $content 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 SlideshowItemQuery The current query, for fluid interface
|
|
*/
|
|
public function filterByContent($content = null, $comparison = null)
|
|
{
|
|
if (null === $comparison) {
|
|
if (is_array($content)) {
|
|
$comparison = Criteria::IN;
|
|
} elseif (preg_match('/[\%\*]/', $content)) {
|
|
$content = str_replace('*', '%', $content);
|
|
$comparison = Criteria::LIKE;
|
|
}
|
|
}
|
|
|
|
return $this->addUsingAlias(SlideshowItemPeer::CONTENT, $content, $comparison);
|
|
}
|
|
|
|
/**
|
|
* Filter the query on the link column
|
|
*
|
|
* Example usage:
|
|
* <code>
|
|
* $query->filterByLink('fooValue'); // WHERE link = 'fooValue'
|
|
* $query->filterByLink('%fooValue%'); // WHERE link LIKE '%fooValue%'
|
|
* </code>
|
|
*
|
|
* @param string $link 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 SlideshowItemQuery The current query, for fluid interface
|
|
*/
|
|
public function filterByLink($link = null, $comparison = null)
|
|
{
|
|
if (null === $comparison) {
|
|
if (is_array($link)) {
|
|
$comparison = Criteria::IN;
|
|
} elseif (preg_match('/[\%\*]/', $link)) {
|
|
$link = str_replace('*', '%', $link);
|
|
$comparison = Criteria::LIKE;
|
|
}
|
|
}
|
|
|
|
return $this->addUsingAlias(SlideshowItemPeer::LINK, $link, $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 SlideshowItemQuery 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(SlideshowItemPeer::CMS_BLOCK_ID, $block->getId(), $comparison);
|
|
} elseif ($block instanceof PropelObjectCollection) {
|
|
if (null === $comparison) {
|
|
$comparison = Criteria::IN;
|
|
}
|
|
|
|
return $this
|
|
->addUsingAlias(SlideshowItemPeer::CMS_BLOCK_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 SlideshowItemQuery 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\ContentManagerBundle\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\ContentManagerBundle\Model\BlockQuery');
|
|
}
|
|
|
|
/**
|
|
* Exclude object from result
|
|
*
|
|
* @param SlideshowItem $slideshowItem Object to remove from the list of results
|
|
*
|
|
* @return SlideshowItemQuery The current query, for fluid interface
|
|
*/
|
|
public function prune($slideshowItem = null)
|
|
{
|
|
if ($slideshowItem) {
|
|
$this->addUsingAlias(SlideshowItemPeer::ID, $slideshowItem->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);
|
|
}
|
|
|
|
// 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);
|
|
}
|
|
}
|