associated content for categories and product tables + loop

This commit is contained in:
Etienne Roudeix
2013-08-23 10:55:59 +02:00
parent 7ef0339784
commit fe4b77f7a8
25 changed files with 11656 additions and 61 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,804 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\CategoryAssociatedContent as ChildCategoryAssociatedContent;
use Thelia\Model\CategoryAssociatedContentQuery as ChildCategoryAssociatedContentQuery;
use Thelia\Model\Map\CategoryAssociatedContentTableMap;
/**
* Base class that represents a query for the 'category_associated_content' table.
*
*
*
* @method ChildCategoryAssociatedContentQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCategoryAssociatedContentQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column
* @method ChildCategoryAssociatedContentQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
* @method ChildCategoryAssociatedContentQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildCategoryAssociatedContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCategoryAssociatedContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildCategoryAssociatedContentQuery groupById() Group by the id column
* @method ChildCategoryAssociatedContentQuery groupByCategoryId() Group by the category_id column
* @method ChildCategoryAssociatedContentQuery groupByContentId() Group by the content_id column
* @method ChildCategoryAssociatedContentQuery groupByPosition() Group by the position column
* @method ChildCategoryAssociatedContentQuery groupByCreatedAt() Group by the created_at column
* @method ChildCategoryAssociatedContentQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildCategoryAssociatedContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCategoryAssociatedContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCategoryAssociatedContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCategoryAssociatedContentQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
* @method ChildCategoryAssociatedContentQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
* @method ChildCategoryAssociatedContentQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
*
* @method ChildCategoryAssociatedContentQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
* @method ChildCategoryAssociatedContentQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
* @method ChildCategoryAssociatedContentQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
*
* @method ChildCategoryAssociatedContent findOne(ConnectionInterface $con = null) Return the first ChildCategoryAssociatedContent matching the query
* @method ChildCategoryAssociatedContent findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCategoryAssociatedContent matching the query, or a new ChildCategoryAssociatedContent object populated from the query conditions when no match is found
*
* @method ChildCategoryAssociatedContent findOneById(int $id) Return the first ChildCategoryAssociatedContent filtered by the id column
* @method ChildCategoryAssociatedContent findOneByCategoryId(int $category_id) Return the first ChildCategoryAssociatedContent filtered by the category_id column
* @method ChildCategoryAssociatedContent findOneByContentId(int $content_id) Return the first ChildCategoryAssociatedContent filtered by the content_id column
* @method ChildCategoryAssociatedContent findOneByPosition(int $position) Return the first ChildCategoryAssociatedContent filtered by the position column
* @method ChildCategoryAssociatedContent findOneByCreatedAt(string $created_at) Return the first ChildCategoryAssociatedContent filtered by the created_at column
* @method ChildCategoryAssociatedContent findOneByUpdatedAt(string $updated_at) Return the first ChildCategoryAssociatedContent filtered by the updated_at column
*
* @method array findById(int $id) Return ChildCategoryAssociatedContent objects filtered by the id column
* @method array findByCategoryId(int $category_id) Return ChildCategoryAssociatedContent objects filtered by the category_id column
* @method array findByContentId(int $content_id) Return ChildCategoryAssociatedContent objects filtered by the content_id column
* @method array findByPosition(int $position) Return ChildCategoryAssociatedContent objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildCategoryAssociatedContent objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCategoryAssociatedContent objects filtered by the updated_at column
*
*/
abstract class CategoryAssociatedContentQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\CategoryAssociatedContentQuery object.
*
* @param string $dbName The database 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 = 'thelia', $modelName = '\\Thelia\\Model\\CategoryAssociatedContent', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCategoryAssociatedContentQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCategoryAssociatedContentQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\CategoryAssociatedContentQuery) {
return $criteria;
}
$query = new \Thelia\Model\CategoryAssociatedContentQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildCategoryAssociatedContent|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CategoryAssociatedContentTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(CategoryAssociatedContentTableMap::DATABASE_NAME);
}
$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 ConnectionInterface $con A connection object
*
* @return ChildCategoryAssociatedContent A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, CATEGORY_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM category_associated_content 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), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildCategoryAssociatedContent();
$obj->hydrate($row);
CategoryAssociatedContentTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCategoryAssociatedContent|array|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;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* 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 ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CategoryAssociatedContentTableMap::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 ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CategoryAssociatedContentTableMap::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
* </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 ChildCategoryAssociatedContentQuery 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(CategoryAssociatedContentTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the category_id column
*
* Example usage:
* <code>
* $query->filterByCategoryId(1234); // WHERE category_id = 1234
* $query->filterByCategoryId(array(12, 34)); // WHERE category_id IN (12, 34)
* $query->filterByCategoryId(array('min' => 12)); // WHERE category_id > 12
* </code>
*
* @see filterByCategory()
*
* @param mixed $categoryId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function filterByCategoryId($categoryId = null, $comparison = null)
{
if (is_array($categoryId)) {
$useMinMax = false;
if (isset($categoryId['min'])) {
$this->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($categoryId['max'])) {
$this->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $categoryId, $comparison);
}
/**
* Filter the query on the content_id column
*
* Example usage:
* <code>
* $query->filterByContentId(1234); // WHERE content_id = 1234
* $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34)
* $query->filterByContentId(array('min' => 12)); // WHERE content_id > 12
* </code>
*
* @see filterByContent()
*
* @param mixed $contentId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function filterByContentId($contentId = null, $comparison = null)
{
if (is_array($contentId)) {
$useMinMax = false;
if (isset($contentId['min'])) {
$this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($contentId['max'])) {
$this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $contentId, $comparison);
}
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position 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 ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function filterByPosition($position = null, $comparison = null)
{
if (is_array($position)) {
$useMinMax = false;
if (isset($position['min'])) {
$this->addUsingAlias(CategoryAssociatedContentTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(CategoryAssociatedContentTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CategoryAssociatedContentTableMap::POSITION, $position, $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 ChildCategoryAssociatedContentQuery 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(CategoryAssociatedContentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CategoryAssociatedContentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CategoryAssociatedContentTableMap::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 ChildCategoryAssociatedContentQuery 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(CategoryAssociatedContentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Category object
*
* @param \Thelia\Model\Category|ObjectCollection $category The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function filterByCategory($category, $comparison = null)
{
if ($category instanceof \Thelia\Model\Category) {
return $this
->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $category->getId(), $comparison);
} elseif ($category instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCategory() only accepts arguments of type \Thelia\Model\Category or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Category relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Category');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Category');
}
return $this;
}
/**
* Use the Category relation Category object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query
*/
public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery');
}
/**
* Filter the query by a related \Thelia\Model\Content object
*
* @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function filterByContent($content, $comparison = null)
{
if ($content instanceof \Thelia\Model\Content) {
return $this
->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $content->getId(), $comparison);
} elseif ($content instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByContent() only accepts arguments of type \Thelia\Model\Content or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Content relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function joinContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Content');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Content');
}
return $this;
}
/**
* Use the Content relation Content object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query
*/
public function useContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinContent($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery');
}
/**
* Exclude object from result
*
* @param ChildCategoryAssociatedContent $categoryAssociatedContent Object to remove from the list of results
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function prune($categoryAssociatedContent = null)
{
if ($categoryAssociatedContent) {
$this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $categoryAssociatedContent->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the category_associated_content table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CategoryAssociatedContentTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($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).
CategoryAssociatedContentTableMap::clearInstancePool();
CategoryAssociatedContentTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCategoryAssociatedContent or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCategoryAssociatedContent object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $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 function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CategoryAssociatedContentTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CategoryAssociatedContentTableMap::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();
CategoryAssociatedContentTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CategoryAssociatedContentTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(CategoryAssociatedContentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(CategoryAssociatedContentTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(CategoryAssociatedContentTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(CategoryAssociatedContentTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(CategoryAssociatedContentTableMap::CREATED_AT);
}
} // CategoryAssociatedContentQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,475 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\CouponI18n as ChildCouponI18n;
use Thelia\Model\CouponI18nQuery as ChildCouponI18nQuery;
use Thelia\Model\Map\CouponI18nTableMap;
/**
* Base class that represents a query for the 'coupon_i18n' table.
*
*
*
* @method ChildCouponI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCouponI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
*
* @method ChildCouponI18nQuery groupById() Group by the id column
* @method ChildCouponI18nQuery groupByLocale() Group by the locale column
*
* @method ChildCouponI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCouponI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCouponI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCouponI18nQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
* @method ChildCouponI18nQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
* @method ChildCouponI18nQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
*
* @method ChildCouponI18n findOne(ConnectionInterface $con = null) Return the first ChildCouponI18n matching the query
* @method ChildCouponI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponI18n matching the query, or a new ChildCouponI18n object populated from the query conditions when no match is found
*
* @method ChildCouponI18n findOneById(int $id) Return the first ChildCouponI18n filtered by the id column
* @method ChildCouponI18n findOneByLocale(string $locale) Return the first ChildCouponI18n filtered by the locale column
*
* @method array findById(int $id) Return ChildCouponI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildCouponI18n objects filtered by the locale column
*
*/
abstract class CouponI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\CouponI18nQuery object.
*
* @param string $dbName The database 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 = 'thelia', $modelName = '\\Thelia\\Model\\CouponI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCouponI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCouponI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\CouponI18nQuery) {
return $criteria;
}
$query = new \Thelia\Model\CouponI18nQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param array[$id, $locale] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildCouponI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CouponI18nTableMap::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::getServiceContainer()->getReadConnection(CouponI18nTableMap::DATABASE_NAME);
}
$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 ConnectionInterface $con A connection object
*
* @return ChildCouponI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE FROM coupon_i18n WHERE ID = :p0 AND LOCALE = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildCouponI18n();
$obj->hydrate($row);
CouponI18nTableMap::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 ConnectionInterface $con A connection object
*
* @return ChildCouponI18n|array|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;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* 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 ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildCouponI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(CouponI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(CouponI18nTableMap::LOCALE, $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 ChildCouponI18nQuery 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(CouponI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(CouponI18nTableMap::LOCALE, $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
* </code>
*
* @see filterByCoupon()
*
* @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 ChildCouponI18nQuery 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(CouponI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CouponI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponI18nTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the locale column
*
* Example usage:
* <code>
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
* </code>
*
* @param string $locale 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 ChildCouponI18nQuery The current query, for fluid interface
*/
public function filterByLocale($locale = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($locale)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $locale)) {
$locale = str_replace('*', '%', $locale);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponI18nTableMap::LOCALE, $locale, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Coupon object
*
* @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponI18nQuery The current query, for fluid interface
*/
public function filterByCoupon($coupon, $comparison = null)
{
if ($coupon instanceof \Thelia\Model\Coupon) {
return $this
->addUsingAlias(CouponI18nTableMap::ID, $coupon->getId(), $comparison);
} elseif ($coupon instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CouponI18nTableMap::ID, $coupon->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Coupon relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCouponI18nQuery The current query, for fluid interface
*/
public function joinCoupon($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Coupon');
// 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, 'Coupon');
}
return $this;
}
/**
* Use the Coupon relation Coupon object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\CouponQuery A secondary query class using the current class as primary query
*/
public function useCouponQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinCoupon($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery');
}
/**
* Exclude object from result
*
* @param ChildCouponI18n $couponI18n Object to remove from the list of results
*
* @return ChildCouponI18nQuery The current query, for fluid interface
*/
public function prune($couponI18n = null)
{
if ($couponI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(CouponI18nTableMap::ID), $couponI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(CouponI18nTableMap::LOCALE), $couponI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the coupon_i18n table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($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).
CouponI18nTableMap::clearInstancePool();
CouponI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCouponI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCouponI18n object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $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 function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CouponI18nTableMap::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();
CouponI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CouponI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // CouponI18nQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,961 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\CouponVersion as ChildCouponVersion;
use Thelia\Model\CouponVersionQuery as ChildCouponVersionQuery;
use Thelia\Model\Map\CouponVersionTableMap;
/**
* Base class that represents a query for the 'coupon_version' table.
*
*
*
* @method ChildCouponVersionQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCouponVersionQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method ChildCouponVersionQuery orderByType($order = Criteria::ASC) Order by the type column
* @method ChildCouponVersionQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildCouponVersionQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column
* @method ChildCouponVersionQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildCouponVersionQuery orderByValue($order = Criteria::ASC) Order by the value column
* @method ChildCouponVersionQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column
* @method ChildCouponVersionQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column
* @method ChildCouponVersionQuery orderByExpirationDate($order = Criteria::ASC) Order by the expiration_date column
* @method ChildCouponVersionQuery orderBySerializedRules($order = Criteria::ASC) Order by the serialized_rules column
* @method ChildCouponVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCouponVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildCouponVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
*
* @method ChildCouponVersionQuery groupById() Group by the id column
* @method ChildCouponVersionQuery groupByCode() Group by the code column
* @method ChildCouponVersionQuery groupByType() Group by the type column
* @method ChildCouponVersionQuery groupByTitle() Group by the title column
* @method ChildCouponVersionQuery groupByShortDescription() Group by the short_description column
* @method ChildCouponVersionQuery groupByDescription() Group by the description column
* @method ChildCouponVersionQuery groupByValue() Group by the value column
* @method ChildCouponVersionQuery groupByIsUsed() Group by the is_used column
* @method ChildCouponVersionQuery groupByIsEnabled() Group by the is_enabled column
* @method ChildCouponVersionQuery groupByExpirationDate() Group by the expiration_date column
* @method ChildCouponVersionQuery groupBySerializedRules() Group by the serialized_rules column
* @method ChildCouponVersionQuery groupByCreatedAt() Group by the created_at column
* @method ChildCouponVersionQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildCouponVersionQuery groupByVersion() Group by the version column
*
* @method ChildCouponVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCouponVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCouponVersionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCouponVersionQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
* @method ChildCouponVersionQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
* @method ChildCouponVersionQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
*
* @method ChildCouponVersion findOne(ConnectionInterface $con = null) Return the first ChildCouponVersion matching the query
* @method ChildCouponVersion findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponVersion matching the query, or a new ChildCouponVersion object populated from the query conditions when no match is found
*
* @method ChildCouponVersion findOneById(int $id) Return the first ChildCouponVersion filtered by the id column
* @method ChildCouponVersion findOneByCode(string $code) Return the first ChildCouponVersion filtered by the code column
* @method ChildCouponVersion findOneByType(string $type) Return the first ChildCouponVersion filtered by the type column
* @method ChildCouponVersion findOneByTitle(string $title) Return the first ChildCouponVersion filtered by the title column
* @method ChildCouponVersion findOneByShortDescription(string $short_description) Return the first ChildCouponVersion filtered by the short_description column
* @method ChildCouponVersion findOneByDescription(string $description) Return the first ChildCouponVersion filtered by the description column
* @method ChildCouponVersion findOneByValue(double $value) Return the first ChildCouponVersion filtered by the value column
* @method ChildCouponVersion findOneByIsUsed(int $is_used) Return the first ChildCouponVersion filtered by the is_used column
* @method ChildCouponVersion findOneByIsEnabled(int $is_enabled) Return the first ChildCouponVersion filtered by the is_enabled column
* @method ChildCouponVersion findOneByExpirationDate(string $expiration_date) Return the first ChildCouponVersion filtered by the expiration_date column
* @method ChildCouponVersion findOneBySerializedRules(string $serialized_rules) Return the first ChildCouponVersion filtered by the serialized_rules column
* @method ChildCouponVersion findOneByCreatedAt(string $created_at) Return the first ChildCouponVersion filtered by the created_at column
* @method ChildCouponVersion findOneByUpdatedAt(string $updated_at) Return the first ChildCouponVersion filtered by the updated_at column
* @method ChildCouponVersion findOneByVersion(int $version) Return the first ChildCouponVersion filtered by the version column
*
* @method array findById(int $id) Return ChildCouponVersion objects filtered by the id column
* @method array findByCode(string $code) Return ChildCouponVersion objects filtered by the code column
* @method array findByType(string $type) Return ChildCouponVersion objects filtered by the type column
* @method array findByTitle(string $title) Return ChildCouponVersion objects filtered by the title column
* @method array findByShortDescription(string $short_description) Return ChildCouponVersion objects filtered by the short_description column
* @method array findByDescription(string $description) Return ChildCouponVersion objects filtered by the description column
* @method array findByValue(double $value) Return ChildCouponVersion objects filtered by the value column
* @method array findByIsUsed(int $is_used) Return ChildCouponVersion objects filtered by the is_used column
* @method array findByIsEnabled(int $is_enabled) Return ChildCouponVersion objects filtered by the is_enabled column
* @method array findByExpirationDate(string $expiration_date) Return ChildCouponVersion objects filtered by the expiration_date column
* @method array findBySerializedRules(string $serialized_rules) Return ChildCouponVersion objects filtered by the serialized_rules column
* @method array findByCreatedAt(string $created_at) Return ChildCouponVersion objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCouponVersion objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildCouponVersion objects filtered by the version column
*
*/
abstract class CouponVersionQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\CouponVersionQuery object.
*
* @param string $dbName The database 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 = 'thelia', $modelName = '\\Thelia\\Model\\CouponVersion', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCouponVersionQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCouponVersionQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\CouponVersionQuery) {
return $criteria;
}
$query = new \Thelia\Model\CouponVersionQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param array[$id, $version] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildCouponVersion|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CouponVersionTableMap::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::getServiceContainer()->getReadConnection(CouponVersionTableMap::DATABASE_NAME);
}
$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 ConnectionInterface $con A connection object
*
* @return ChildCouponVersion A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, CODE, TYPE, TITLE, SHORT_DESCRIPTION, DESCRIPTION, VALUE, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, CREATED_AT, UPDATED_AT, VERSION FROM coupon_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), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildCouponVersion();
$obj->hydrate($row);
CouponVersionTableMap::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 ConnectionInterface $con A connection object
*
* @return ChildCouponVersion|array|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;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* 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 ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(CouponVersionTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(CouponVersionTableMap::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 ChildCouponVersionQuery 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(CouponVersionTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(CouponVersionTableMap::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
* </code>
*
* @see filterByCoupon()
*
* @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 ChildCouponVersionQuery 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(CouponVersionTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CouponVersionTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponVersionTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the code column
*
* Example usage:
* <code>
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
* </code>
*
* @param string $code 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 ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByCode($code = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($code)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $code)) {
$code = str_replace('*', '%', $code);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponVersionTableMap::CODE, $code, $comparison);
}
/**
* Filter the query on the type column
*
* Example usage:
* <code>
* $query->filterByType('fooValue'); // WHERE type = 'fooValue'
* $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
* </code>
*
* @param string $type 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 ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByType($type = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($type)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $type)) {
$type = str_replace('*', '%', $type);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponVersionTableMap::TYPE, $type, $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 ChildCouponVersionQuery 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(CouponVersionTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query on the short_description column
*
* Example usage:
* <code>
* $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue'
* $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%'
* </code>
*
* @param string $shortDescription 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 ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByShortDescription($shortDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($shortDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $shortDescription)) {
$shortDescription = str_replace('*', '%', $shortDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponVersionTableMap::SHORT_DESCRIPTION, $shortDescription, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $description The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByDescription($description = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($description)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $description)) {
$description = str_replace('*', '%', $description);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponVersionTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the value column
*
* Example usage:
* <code>
* $query->filterByValue(1234); // WHERE value = 1234
* $query->filterByValue(array(12, 34)); // WHERE value IN (12, 34)
* $query->filterByValue(array('min' => 12)); // WHERE value > 12
* </code>
*
* @param mixed $value 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 ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByValue($value = null, $comparison = null)
{
if (is_array($value)) {
$useMinMax = false;
if (isset($value['min'])) {
$this->addUsingAlias(CouponVersionTableMap::VALUE, $value['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($value['max'])) {
$this->addUsingAlias(CouponVersionTableMap::VALUE, $value['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponVersionTableMap::VALUE, $value, $comparison);
}
/**
* Filter the query on the is_used column
*
* Example usage:
* <code>
* $query->filterByIsUsed(1234); // WHERE is_used = 1234
* $query->filterByIsUsed(array(12, 34)); // WHERE is_used IN (12, 34)
* $query->filterByIsUsed(array('min' => 12)); // WHERE is_used > 12
* </code>
*
* @param mixed $isUsed 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 ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByIsUsed($isUsed = null, $comparison = null)
{
if (is_array($isUsed)) {
$useMinMax = false;
if (isset($isUsed['min'])) {
$this->addUsingAlias(CouponVersionTableMap::IS_USED, $isUsed['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($isUsed['max'])) {
$this->addUsingAlias(CouponVersionTableMap::IS_USED, $isUsed['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponVersionTableMap::IS_USED, $isUsed, $comparison);
}
/**
* Filter the query on the is_enabled column
*
* Example usage:
* <code>
* $query->filterByIsEnabled(1234); // WHERE is_enabled = 1234
* $query->filterByIsEnabled(array(12, 34)); // WHERE is_enabled IN (12, 34)
* $query->filterByIsEnabled(array('min' => 12)); // WHERE is_enabled > 12
* </code>
*
* @param mixed $isEnabled 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 ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByIsEnabled($isEnabled = null, $comparison = null)
{
if (is_array($isEnabled)) {
$useMinMax = false;
if (isset($isEnabled['min'])) {
$this->addUsingAlias(CouponVersionTableMap::IS_ENABLED, $isEnabled['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($isEnabled['max'])) {
$this->addUsingAlias(CouponVersionTableMap::IS_ENABLED, $isEnabled['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponVersionTableMap::IS_ENABLED, $isEnabled, $comparison);
}
/**
* Filter the query on the expiration_date column
*
* Example usage:
* <code>
* $query->filterByExpirationDate('2011-03-14'); // WHERE expiration_date = '2011-03-14'
* $query->filterByExpirationDate('now'); // WHERE expiration_date = '2011-03-14'
* $query->filterByExpirationDate(array('max' => 'yesterday')); // WHERE expiration_date > '2011-03-13'
* </code>
*
* @param mixed $expirationDate 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 ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByExpirationDate($expirationDate = null, $comparison = null)
{
if (is_array($expirationDate)) {
$useMinMax = false;
if (isset($expirationDate['min'])) {
$this->addUsingAlias(CouponVersionTableMap::EXPIRATION_DATE, $expirationDate['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($expirationDate['max'])) {
$this->addUsingAlias(CouponVersionTableMap::EXPIRATION_DATE, $expirationDate['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponVersionTableMap::EXPIRATION_DATE, $expirationDate, $comparison);
}
/**
* Filter the query on the serialized_rules column
*
* Example usage:
* <code>
* $query->filterBySerializedRules('fooValue'); // WHERE serialized_rules = 'fooValue'
* $query->filterBySerializedRules('%fooValue%'); // WHERE serialized_rules LIKE '%fooValue%'
* </code>
*
* @param string $serializedRules 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 ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterBySerializedRules($serializedRules = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($serializedRules)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $serializedRules)) {
$serializedRules = str_replace('*', '%', $serializedRules);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponVersionTableMap::SERIALIZED_RULES, $serializedRules, $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 ChildCouponVersionQuery 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(CouponVersionTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CouponVersionTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponVersionTableMap::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 ChildCouponVersionQuery 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(CouponVersionTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CouponVersionTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponVersionTableMap::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
* </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 ChildCouponVersionQuery 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(CouponVersionTableMap::VERSION, $version['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($version['max'])) {
$this->addUsingAlias(CouponVersionTableMap::VERSION, $version['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponVersionTableMap::VERSION, $version, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Coupon object
*
* @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByCoupon($coupon, $comparison = null)
{
if ($coupon instanceof \Thelia\Model\Coupon) {
return $this
->addUsingAlias(CouponVersionTableMap::ID, $coupon->getId(), $comparison);
} elseif ($coupon instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CouponVersionTableMap::ID, $coupon->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Coupon relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCouponVersionQuery The current query, for fluid interface
*/
public function joinCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Coupon');
// 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, 'Coupon');
}
return $this;
}
/**
* Use the Coupon relation Coupon object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\CouponQuery A secondary query class using the current class as primary query
*/
public function useCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCoupon($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery');
}
/**
* Exclude object from result
*
* @param ChildCouponVersion $couponVersion Object to remove from the list of results
*
* @return ChildCouponVersionQuery The current query, for fluid interface
*/
public function prune($couponVersion = null)
{
if ($couponVersion) {
$this->addCond('pruneCond0', $this->getAliasedColName(CouponVersionTableMap::ID), $couponVersion->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(CouponVersionTableMap::VERSION), $couponVersion->getVersion(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the coupon_version table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CouponVersionTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($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).
CouponVersionTableMap::clearInstancePool();
CouponVersionTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCouponVersion or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCouponVersion object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $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 function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CouponVersionTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CouponVersionTableMap::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();
CouponVersionTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CouponVersionTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // CouponVersionQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,804 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\ProductAssociatedContent as ChildProductAssociatedContent;
use Thelia\Model\ProductAssociatedContentQuery as ChildProductAssociatedContentQuery;
use Thelia\Model\Map\ProductAssociatedContentTableMap;
/**
* Base class that represents a query for the 'product_associated_content' table.
*
*
*
* @method ChildProductAssociatedContentQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildProductAssociatedContentQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
* @method ChildProductAssociatedContentQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
* @method ChildProductAssociatedContentQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildProductAssociatedContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductAssociatedContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildProductAssociatedContentQuery groupById() Group by the id column
* @method ChildProductAssociatedContentQuery groupByProductId() Group by the product_id column
* @method ChildProductAssociatedContentQuery groupByContentId() Group by the content_id column
* @method ChildProductAssociatedContentQuery groupByPosition() Group by the position column
* @method ChildProductAssociatedContentQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductAssociatedContentQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildProductAssociatedContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildProductAssociatedContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildProductAssociatedContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildProductAssociatedContentQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
* @method ChildProductAssociatedContentQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
* @method ChildProductAssociatedContentQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
*
* @method ChildProductAssociatedContentQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
* @method ChildProductAssociatedContentQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
* @method ChildProductAssociatedContentQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
*
* @method ChildProductAssociatedContent findOne(ConnectionInterface $con = null) Return the first ChildProductAssociatedContent matching the query
* @method ChildProductAssociatedContent findOneOrCreate(ConnectionInterface $con = null) Return the first ChildProductAssociatedContent matching the query, or a new ChildProductAssociatedContent object populated from the query conditions when no match is found
*
* @method ChildProductAssociatedContent findOneById(int $id) Return the first ChildProductAssociatedContent filtered by the id column
* @method ChildProductAssociatedContent findOneByProductId(int $product_id) Return the first ChildProductAssociatedContent filtered by the product_id column
* @method ChildProductAssociatedContent findOneByContentId(int $content_id) Return the first ChildProductAssociatedContent filtered by the content_id column
* @method ChildProductAssociatedContent findOneByPosition(int $position) Return the first ChildProductAssociatedContent filtered by the position column
* @method ChildProductAssociatedContent findOneByCreatedAt(string $created_at) Return the first ChildProductAssociatedContent filtered by the created_at column
* @method ChildProductAssociatedContent findOneByUpdatedAt(string $updated_at) Return the first ChildProductAssociatedContent filtered by the updated_at column
*
* @method array findById(int $id) Return ChildProductAssociatedContent objects filtered by the id column
* @method array findByProductId(int $product_id) Return ChildProductAssociatedContent objects filtered by the product_id column
* @method array findByContentId(int $content_id) Return ChildProductAssociatedContent objects filtered by the content_id column
* @method array findByPosition(int $position) Return ChildProductAssociatedContent objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildProductAssociatedContent objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProductAssociatedContent objects filtered by the updated_at column
*
*/
abstract class ProductAssociatedContentQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\ProductAssociatedContentQuery object.
*
* @param string $dbName The database 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 = 'thelia', $modelName = '\\Thelia\\Model\\ProductAssociatedContent', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildProductAssociatedContentQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildProductAssociatedContentQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\ProductAssociatedContentQuery) {
return $criteria;
}
$query = new \Thelia\Model\ProductAssociatedContentQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildProductAssociatedContent|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ProductAssociatedContentTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(ProductAssociatedContentTableMap::DATABASE_NAME);
}
$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 ConnectionInterface $con A connection object
*
* @return ChildProductAssociatedContent A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, PRODUCT_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM product_associated_content 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), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildProductAssociatedContent();
$obj->hydrate($row);
ProductAssociatedContentTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildProductAssociatedContent|array|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;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* 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 ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(ProductAssociatedContentTableMap::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 ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ProductAssociatedContentTableMap::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
* </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 ChildProductAssociatedContentQuery 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(ProductAssociatedContentTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(ProductAssociatedContentTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProductAssociatedContentTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the product_id column
*
* Example usage:
* <code>
* $query->filterByProductId(1234); // WHERE product_id = 1234
* $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34)
* $query->filterByProductId(array('min' => 12)); // WHERE product_id > 12
* </code>
*
* @see filterByProduct()
*
* @param mixed $productId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function filterByProductId($productId = null, $comparison = null)
{
if (is_array($productId)) {
$useMinMax = false;
if (isset($productId['min'])) {
$this->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($productId['max'])) {
$this->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $productId, $comparison);
}
/**
* Filter the query on the content_id column
*
* Example usage:
* <code>
* $query->filterByContentId(1234); // WHERE content_id = 1234
* $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34)
* $query->filterByContentId(array('min' => 12)); // WHERE content_id > 12
* </code>
*
* @see filterByContent()
*
* @param mixed $contentId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function filterByContentId($contentId = null, $comparison = null)
{
if (is_array($contentId)) {
$useMinMax = false;
if (isset($contentId['min'])) {
$this->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($contentId['max'])) {
$this->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $contentId, $comparison);
}
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position 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 ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function filterByPosition($position = null, $comparison = null)
{
if (is_array($position)) {
$useMinMax = false;
if (isset($position['min'])) {
$this->addUsingAlias(ProductAssociatedContentTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(ProductAssociatedContentTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProductAssociatedContentTableMap::POSITION, $position, $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 ChildProductAssociatedContentQuery 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(ProductAssociatedContentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(ProductAssociatedContentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProductAssociatedContentTableMap::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 ChildProductAssociatedContentQuery 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(ProductAssociatedContentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Product object
*
* @param \Thelia\Model\Product|ObjectCollection $product The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function filterByProduct($product, $comparison = null)
{
if ($product instanceof \Thelia\Model\Product) {
return $this
->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $product->getId(), $comparison);
} elseif ($product instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Product relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Product');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Product');
}
return $this;
}
/**
* Use the Product relation Product object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
*/
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinProduct($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
}
/**
* Filter the query by a related \Thelia\Model\Content object
*
* @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function filterByContent($content, $comparison = null)
{
if ($content instanceof \Thelia\Model\Content) {
return $this
->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $content->getId(), $comparison);
} elseif ($content instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByContent() only accepts arguments of type \Thelia\Model\Content or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Content relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function joinContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Content');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Content');
}
return $this;
}
/**
* Use the Content relation Content object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query
*/
public function useContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinContent($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery');
}
/**
* Exclude object from result
*
* @param ChildProductAssociatedContent $productAssociatedContent Object to remove from the list of results
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function prune($productAssociatedContent = null)
{
if ($productAssociatedContent) {
$this->addUsingAlias(ProductAssociatedContentTableMap::ID, $productAssociatedContent->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the product_associated_content table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(ProductAssociatedContentTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($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).
ProductAssociatedContentTableMap::clearInstancePool();
ProductAssociatedContentTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildProductAssociatedContent or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildProductAssociatedContent object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $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 function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(ProductAssociatedContentTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(ProductAssociatedContentTableMap::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();
ProductAssociatedContentTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
ProductAssociatedContentTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(ProductAssociatedContentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(ProductAssociatedContentTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(ProductAssociatedContentTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(ProductAssociatedContentTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildProductAssociatedContentQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(ProductAssociatedContentTableMap::CREATED_AT);
}
} // ProductAssociatedContentQuery