associated content for categories and product tables + loop
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
<loops>
|
||||
<loop class="Thelia\Core\Template\Loop\Accessory" name="accessory"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Address" name="address"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AssociatedContent" name="associated_content"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Attribute" name="attribute"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AttributeAvailability" name="attribute_availability"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AttributeCombination" name="attribute_combination"/>
|
||||
|
||||
127
core/lib/Thelia/Core/Template/Loop/AssociatedContent.php
Executable file
127
core/lib/Thelia/Core/Template/Loop/AssociatedContent.php
Executable file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Thelia\Core\Template\Loop\Content;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\ProductAssociatedContentQuery;
|
||||
use Thelia\Model\CategoryAssociatedContentQuery;
|
||||
use Thelia\Type;
|
||||
|
||||
/**
|
||||
*
|
||||
* AssociatedContent loop
|
||||
*
|
||||
*
|
||||
* Class AssociatedContent
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class AssociatedContent extends Content
|
||||
{
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
$argumentCollection = parent::getArgDefinitions();
|
||||
|
||||
$argumentCollection->addArgument(Argument::createIntTypeArgument('product'))
|
||||
->addArgument(Argument::createIntTypeArgument('category'));
|
||||
|
||||
$argumentCollection->get('order')->default = "associated_content";
|
||||
|
||||
$argumentCollection->get('order')->type->getKey(0)->addValue('associated_content');
|
||||
$argumentCollection->get('order')->type->getKey(0)->addValue('associated_content_reverse');
|
||||
|
||||
return $argumentCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
* @return \Thelia\Core\Template\Element\LoopResult
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
//
|
||||
|
||||
$product = $this->getProduct();
|
||||
$category = $this->getCategory();
|
||||
|
||||
if($product === null && $category === null) {
|
||||
throw new \InvalidArgumentException('You have to provide either `product` or `category` argument in associated_content loop');
|
||||
}
|
||||
|
||||
if($product !== null) {
|
||||
$search = ProductAssociatedContentQuery::create();
|
||||
|
||||
$search->filterByProductId($product, Criteria::EQUAL);
|
||||
} elseif($category !== null) {
|
||||
$search = CategoryAssociatedContentQuery::create();
|
||||
|
||||
$search->filterByCategoryId($category, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$order = $this->getOrder();
|
||||
$orderByAssociatedContent = array_search('associated_content', $order);
|
||||
$orderByAssociatedContentReverse = array_search('associated_content_reverse', $order);
|
||||
|
||||
if ($orderByAssociatedContent !== false) {
|
||||
$search->orderByPosition(Criteria::ASC);
|
||||
$order[$orderByAssociatedContent] = 'given_id';
|
||||
$this->args->get('order')->setValue( implode(',', $order) );
|
||||
}
|
||||
if ($orderByAssociatedContentReverse !== false) {
|
||||
$search->orderByPosition(Criteria::DESC);
|
||||
$order[$orderByAssociatedContentReverse] = 'given_id';
|
||||
$this->args->get('order')->setValue( implode(',', $order) );
|
||||
}
|
||||
|
||||
$associatedContents = $this->search($search);
|
||||
|
||||
$associatedContentIdList = array(0);
|
||||
foreach ($associatedContents as $associatedContent) {
|
||||
array_push($associatedContentIdList, $associatedContent->getContentId());
|
||||
}
|
||||
|
||||
$receivedIdList = $this->getId();
|
||||
|
||||
/* if an Id list is receive, loop will only match accessories from this list */
|
||||
if ($receivedIdList === null) {
|
||||
$this->args->get('id')->setValue( implode(',', $associatedContentIdList) );
|
||||
} else {
|
||||
$this->args->get('id')->setValue( implode(',', array_intersect($receivedIdList, $associatedContentIdList)) );
|
||||
}
|
||||
|
||||
return parent::exec($pagination);
|
||||
}
|
||||
|
||||
}
|
||||
1553
core/lib/Thelia/Model/Base/CategoryAssociatedContent.php
Normal file
1553
core/lib/Thelia/Model/Base/CategoryAssociatedContent.php
Normal file
File diff suppressed because it is too large
Load Diff
804
core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php
Normal file
804
core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php
Normal 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
|
||||
1207
core/lib/Thelia/Model/Base/CouponI18n.php
Normal file
1207
core/lib/Thelia/Model/Base/CouponI18n.php
Normal file
File diff suppressed because it is too large
Load Diff
475
core/lib/Thelia/Model/Base/CouponI18nQuery.php
Normal file
475
core/lib/Thelia/Model/Base/CouponI18nQuery.php
Normal 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
|
||||
1941
core/lib/Thelia/Model/Base/CouponVersion.php
Normal file
1941
core/lib/Thelia/Model/Base/CouponVersion.php
Normal file
File diff suppressed because it is too large
Load Diff
961
core/lib/Thelia/Model/Base/CouponVersionQuery.php
Normal file
961
core/lib/Thelia/Model/Base/CouponVersionQuery.php
Normal 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
|
||||
1553
core/lib/Thelia/Model/Base/ProductAssociatedContent.php
Normal file
1553
core/lib/Thelia/Model/Base/ProductAssociatedContent.php
Normal file
File diff suppressed because it is too large
Load Diff
804
core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php
Normal file
804
core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php
Normal 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
|
||||
9
core/lib/Thelia/Model/CategoryAssociatedContent.php
Normal file
9
core/lib/Thelia/Model/CategoryAssociatedContent.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CategoryAssociatedContent as BaseCategoryAssociatedContent;
|
||||
|
||||
class CategoryAssociatedContent extends BaseCategoryAssociatedContent {
|
||||
|
||||
}
|
||||
20
core/lib/Thelia/Model/CategoryAssociatedContentQuery.php
Normal file
20
core/lib/Thelia/Model/CategoryAssociatedContentQuery.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CategoryAssociatedContentQuery as BaseCategoryAssociatedContentQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'category_associated_content' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class CategoryAssociatedContentQuery extends BaseCategoryAssociatedContentQuery {
|
||||
|
||||
} // CategoryAssociatedContentQuery
|
||||
9
core/lib/Thelia/Model/CouponI18n.php
Normal file
9
core/lib/Thelia/Model/CouponI18n.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CouponI18n as BaseCouponI18n;
|
||||
|
||||
class CouponI18n extends BaseCouponI18n {
|
||||
|
||||
}
|
||||
20
core/lib/Thelia/Model/CouponI18nQuery.php
Normal file
20
core/lib/Thelia/Model/CouponI18nQuery.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CouponI18nQuery as BaseCouponI18nQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'coupon_i18n' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class CouponI18nQuery extends BaseCouponI18nQuery {
|
||||
|
||||
} // CouponI18nQuery
|
||||
9
core/lib/Thelia/Model/CouponVersion.php
Normal file
9
core/lib/Thelia/Model/CouponVersion.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CouponVersion as BaseCouponVersion;
|
||||
|
||||
class CouponVersion extends BaseCouponVersion {
|
||||
|
||||
}
|
||||
20
core/lib/Thelia/Model/CouponVersionQuery.php
Normal file
20
core/lib/Thelia/Model/CouponVersionQuery.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CouponVersionQuery as BaseCouponVersionQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'coupon_version' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class CouponVersionQuery extends BaseCouponVersionQuery {
|
||||
|
||||
} // CouponVersionQuery
|
||||
456
core/lib/Thelia/Model/Map/CategoryAssociatedContentTableMap.php
Normal file
456
core/lib/Thelia/Model/Map/CategoryAssociatedContentTableMap.php
Normal file
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\CategoryAssociatedContent;
|
||||
use Thelia\Model\CategoryAssociatedContentQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'category_associated_content' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class CategoryAssociatedContentTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.CategoryAssociatedContentTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'category_associated_content';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\CategoryAssociatedContent';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.CategoryAssociatedContent';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 6;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 6;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'category_associated_content.ID';
|
||||
|
||||
/**
|
||||
* the column name for the CATEGORY_ID field
|
||||
*/
|
||||
const CATEGORY_ID = 'category_associated_content.CATEGORY_ID';
|
||||
|
||||
/**
|
||||
* the column name for the CONTENT_ID field
|
||||
*/
|
||||
const CONTENT_ID = 'category_associated_content.CONTENT_ID';
|
||||
|
||||
/**
|
||||
* the column name for the POSITION field
|
||||
*/
|
||||
const POSITION = 'category_associated_content.POSITION';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
const CREATED_AT = 'category_associated_content.CREATED_AT';
|
||||
|
||||
/**
|
||||
* the column name for the UPDATED_AT field
|
||||
*/
|
||||
const UPDATED_AT = 'category_associated_content.UPDATED_AT';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'CategoryId', 'ContentId', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'categoryId', 'contentId', 'position', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CategoryAssociatedContentTableMap::ID, CategoryAssociatedContentTableMap::CATEGORY_ID, CategoryAssociatedContentTableMap::CONTENT_ID, CategoryAssociatedContentTableMap::POSITION, CategoryAssociatedContentTableMap::CREATED_AT, CategoryAssociatedContentTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CATEGORY_ID', 'CONTENT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'category_id', 'content_id', 'position', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'CategoryId' => 1, 'ContentId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'categoryId' => 1, 'contentId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
|
||||
self::TYPE_COLNAME => array(CategoryAssociatedContentTableMap::ID => 0, CategoryAssociatedContentTableMap::CATEGORY_ID => 1, CategoryAssociatedContentTableMap::CONTENT_ID => 2, CategoryAssociatedContentTableMap::POSITION => 3, CategoryAssociatedContentTableMap::CREATED_AT => 4, CategoryAssociatedContentTableMap::UPDATED_AT => 5, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CATEGORY_ID' => 1, 'CONTENT_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'category_id' => 1, 'content_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('category_associated_content');
|
||||
$this->setPhpName('CategoryAssociatedContent');
|
||||
$this->setClassName('\\Thelia\\Model\\CategoryAssociatedContent');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', true, null, null);
|
||||
$this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', true, null, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Content', '\\Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return (int) $row[
|
||||
$indexType == TableMap::TYPE_NUM
|
||||
? 0 + $offset
|
||||
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? CategoryAssociatedContentTableMap::CLASS_DEFAULT : CategoryAssociatedContentTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (CategoryAssociatedContent object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = CategoryAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = CategoryAssociatedContentTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + CategoryAssociatedContentTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = CategoryAssociatedContentTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
CategoryAssociatedContentTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = CategoryAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = CategoryAssociatedContentTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
CategoryAssociatedContentTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::ID);
|
||||
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::CATEGORY_ID);
|
||||
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::CONTENT_ID);
|
||||
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::POSITION);
|
||||
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CategoryAssociatedContentTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.CATEGORY_ID');
|
||||
$criteria->addSelectColumn($alias . '.CONTENT_ID');
|
||||
$criteria->addSelectColumn($alias . '.POSITION');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(CategoryAssociatedContentTableMap::DATABASE_NAME)->getTable(CategoryAssociatedContentTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CategoryAssociatedContentTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(CategoryAssociatedContentTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new CategoryAssociatedContentTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a CategoryAssociatedContent or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or CategoryAssociatedContent 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 static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CategoryAssociatedContentTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\CategoryAssociatedContent) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(CategoryAssociatedContentTableMap::DATABASE_NAME);
|
||||
$criteria->add(CategoryAssociatedContentTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = CategoryAssociatedContentQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { CategoryAssociatedContentTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { CategoryAssociatedContentTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return CategoryAssociatedContentQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a CategoryAssociatedContent or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or CategoryAssociatedContent object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CategoryAssociatedContentTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from CategoryAssociatedContent object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(CategoryAssociatedContentTableMap::ID) && $criteria->keyContainsValue(CategoryAssociatedContentTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CategoryAssociatedContentTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = CategoryAssociatedContentQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // CategoryAssociatedContentTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
CategoryAssociatedContentTableMap::buildTableMap();
|
||||
465
core/lib/Thelia/Model/Map/CouponI18nTableMap.php
Normal file
465
core/lib/Thelia/Model/Map/CouponI18nTableMap.php
Normal file
@@ -0,0 +1,465 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\CouponI18n;
|
||||
use Thelia\Model\CouponI18nQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'coupon_i18n' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class CouponI18nTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.CouponI18nTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'coupon_i18n';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\CouponI18n';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.CouponI18n';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'coupon_i18n.ID';
|
||||
|
||||
/**
|
||||
* the column name for the LOCALE field
|
||||
*/
|
||||
const LOCALE = 'coupon_i18n.LOCALE';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Locale', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'locale', ),
|
||||
self::TYPE_COLNAME => array(CouponI18nTableMap::ID, CouponI18nTableMap::LOCALE, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'locale', ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, ),
|
||||
self::TYPE_COLNAME => array(CouponI18nTableMap::ID => 0, CouponI18nTableMap::LOCALE => 1, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('coupon_i18n');
|
||||
$this->setPhpName('CouponI18n');
|
||||
$this->setClassName('\\Thelia\\Model\\CouponI18n');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Adds an object to the instance pool.
|
||||
*
|
||||
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||
* from the database. In some cases you may need to explicitly add objects
|
||||
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||
* and findPk*() calls.
|
||||
*
|
||||
* @param \Thelia\Model\CouponI18n $obj A \Thelia\Model\CouponI18n object.
|
||||
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||
*/
|
||||
public static function addInstanceToPool($obj, $key = null)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled()) {
|
||||
if (null === $key) {
|
||||
$key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
|
||||
} // if key === null
|
||||
self::$instances[$key] = $obj;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an object from the instance pool.
|
||||
*
|
||||
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||
* from the database. In some cases -- especially when you override doDelete
|
||||
* methods in your stub classes -- you may need to explicitly remove objects
|
||||
* from the cache in order to prevent returning objects that no longer exist.
|
||||
*
|
||||
* @param mixed $value A \Thelia\Model\CouponI18n object or a primary key value.
|
||||
*/
|
||||
public static function removeInstanceFromPool($value)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||
if (is_object($value) && $value instanceof \Thelia\Model\CouponI18n) {
|
||||
$key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
|
||||
|
||||
} elseif (is_array($value) && count($value) === 2) {
|
||||
// assume we've been passed a primary key";
|
||||
$key = serialize(array((string) $value[0], (string) $value[1]));
|
||||
} elseif ($value instanceof Criteria) {
|
||||
self::$instances = [];
|
||||
|
||||
return;
|
||||
} else {
|
||||
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\CouponI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||
throw $e;
|
||||
}
|
||||
|
||||
unset(self::$instances[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return $pks;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? CouponI18nTableMap::CLASS_DEFAULT : CouponI18nTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (CouponI18n object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = CouponI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = CouponI18nTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + CouponI18nTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = CouponI18nTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
CouponI18nTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = CouponI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = CouponI18nTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
CouponI18nTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CouponI18nTableMap::ID);
|
||||
$criteria->addSelectColumn(CouponI18nTableMap::LOCALE);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.LOCALE');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(CouponI18nTableMap::DATABASE_NAME)->getTable(CouponI18nTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponI18nTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(CouponI18nTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new CouponI18nTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a CouponI18n or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or CouponI18n 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 static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\CouponI18n) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(CouponI18nTableMap::DATABASE_NAME);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey values
|
||||
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
$criterion = $criteria->getNewCriterion(CouponI18nTableMap::ID, $value[0]);
|
||||
$criterion->addAnd($criteria->getNewCriterion(CouponI18nTableMap::LOCALE, $value[1]));
|
||||
$criteria->addOr($criterion);
|
||||
}
|
||||
}
|
||||
|
||||
$query = CouponI18nQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { CouponI18nTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { CouponI18nTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return CouponI18nQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a CouponI18n or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or CouponI18n object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from CouponI18n object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = CouponI18nQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // CouponI18nTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
CouponI18nTableMap::buildTableMap();
|
||||
561
core/lib/Thelia/Model/Map/CouponVersionTableMap.php
Normal file
561
core/lib/Thelia/Model/Map/CouponVersionTableMap.php
Normal file
@@ -0,0 +1,561 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\CouponVersion;
|
||||
use Thelia\Model\CouponVersionQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'coupon_version' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class CouponVersionTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.CouponVersionTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'coupon_version';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\CouponVersion';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.CouponVersion';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 14;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 14;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'coupon_version.ID';
|
||||
|
||||
/**
|
||||
* the column name for the CODE field
|
||||
*/
|
||||
const CODE = 'coupon_version.CODE';
|
||||
|
||||
/**
|
||||
* the column name for the TYPE field
|
||||
*/
|
||||
const TYPE = 'coupon_version.TYPE';
|
||||
|
||||
/**
|
||||
* the column name for the TITLE field
|
||||
*/
|
||||
const TITLE = 'coupon_version.TITLE';
|
||||
|
||||
/**
|
||||
* the column name for the SHORT_DESCRIPTION field
|
||||
*/
|
||||
const SHORT_DESCRIPTION = 'coupon_version.SHORT_DESCRIPTION';
|
||||
|
||||
/**
|
||||
* the column name for the DESCRIPTION field
|
||||
*/
|
||||
const DESCRIPTION = 'coupon_version.DESCRIPTION';
|
||||
|
||||
/**
|
||||
* the column name for the VALUE field
|
||||
*/
|
||||
const VALUE = 'coupon_version.VALUE';
|
||||
|
||||
/**
|
||||
* the column name for the IS_USED field
|
||||
*/
|
||||
const IS_USED = 'coupon_version.IS_USED';
|
||||
|
||||
/**
|
||||
* the column name for the IS_ENABLED field
|
||||
*/
|
||||
const IS_ENABLED = 'coupon_version.IS_ENABLED';
|
||||
|
||||
/**
|
||||
* the column name for the EXPIRATION_DATE field
|
||||
*/
|
||||
const EXPIRATION_DATE = 'coupon_version.EXPIRATION_DATE';
|
||||
|
||||
/**
|
||||
* the column name for the SERIALIZED_RULES field
|
||||
*/
|
||||
const SERIALIZED_RULES = 'coupon_version.SERIALIZED_RULES';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
const CREATED_AT = 'coupon_version.CREATED_AT';
|
||||
|
||||
/**
|
||||
* the column name for the UPDATED_AT field
|
||||
*/
|
||||
const UPDATED_AT = 'coupon_version.UPDATED_AT';
|
||||
|
||||
/**
|
||||
* the column name for the VERSION field
|
||||
*/
|
||||
const VERSION = 'coupon_version.VERSION';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Value', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'value', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'createdAt', 'updatedAt', 'version', ),
|
||||
self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::TITLE, CouponVersionTableMap::SHORT_DESCRIPTION, CouponVersionTableMap::DESCRIPTION, CouponVersionTableMap::VALUE, CouponVersionTableMap::IS_USED, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::SERIALIZED_RULES, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'VALUE', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'value', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'created_at', 'updated_at', 'version', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Value' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRules' => 10, 'CreatedAt' => 11, 'UpdatedAt' => 12, 'Version' => 13, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'value' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRules' => 10, 'createdAt' => 11, 'updatedAt' => 12, 'version' => 13, ),
|
||||
self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::TITLE => 3, CouponVersionTableMap::SHORT_DESCRIPTION => 4, CouponVersionTableMap::DESCRIPTION => 5, CouponVersionTableMap::VALUE => 6, CouponVersionTableMap::IS_USED => 7, CouponVersionTableMap::IS_ENABLED => 8, CouponVersionTableMap::EXPIRATION_DATE => 9, CouponVersionTableMap::SERIALIZED_RULES => 10, CouponVersionTableMap::CREATED_AT => 11, CouponVersionTableMap::UPDATED_AT => 12, CouponVersionTableMap::VERSION => 13, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'VALUE' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES' => 10, 'CREATED_AT' => 11, 'UPDATED_AT' => 12, 'VERSION' => 13, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'value' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules' => 10, 'created_at' => 11, 'updated_at' => 12, 'version' => 13, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('coupon_version');
|
||||
$this->setPhpName('CouponVersion');
|
||||
$this->setClassName('\\Thelia\\Model\\CouponVersion');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null);
|
||||
$this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null);
|
||||
$this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null);
|
||||
$this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null);
|
||||
$this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('SERIALIZED_RULES', 'SerializedRules', 'LONGVARCHAR', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
* Adds an object to the instance pool.
|
||||
*
|
||||
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||
* from the database. In some cases you may need to explicitly add objects
|
||||
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||
* and findPk*() calls.
|
||||
*
|
||||
* @param \Thelia\Model\CouponVersion $obj A \Thelia\Model\CouponVersion object.
|
||||
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||
*/
|
||||
public static function addInstanceToPool($obj, $key = null)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled()) {
|
||||
if (null === $key) {
|
||||
$key = serialize(array((string) $obj->getId(), (string) $obj->getVersion()));
|
||||
} // if key === null
|
||||
self::$instances[$key] = $obj;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an object from the instance pool.
|
||||
*
|
||||
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||
* from the database. In some cases -- especially when you override doDelete
|
||||
* methods in your stub classes -- you may need to explicitly remove objects
|
||||
* from the cache in order to prevent returning objects that no longer exist.
|
||||
*
|
||||
* @param mixed $value A \Thelia\Model\CouponVersion object or a primary key value.
|
||||
*/
|
||||
public static function removeInstanceFromPool($value)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||
if (is_object($value) && $value instanceof \Thelia\Model\CouponVersion) {
|
||||
$key = serialize(array((string) $value->getId(), (string) $value->getVersion()));
|
||||
|
||||
} elseif (is_array($value) && count($value) === 2) {
|
||||
// assume we've been passed a primary key";
|
||||
$key = serialize(array((string) $value[0], (string) $value[1]));
|
||||
} elseif ($value instanceof Criteria) {
|
||||
self::$instances = [];
|
||||
|
||||
return;
|
||||
} else {
|
||||
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\CouponVersion object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||
throw $e;
|
||||
}
|
||||
|
||||
unset(self::$instances[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 13 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 13 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return $pks;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? CouponVersionTableMap::CLASS_DEFAULT : CouponVersionTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (CouponVersion object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = CouponVersionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = CouponVersionTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + CouponVersionTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = CouponVersionTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
CouponVersionTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = CouponVersionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = CouponVersionTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
CouponVersionTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::ID);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::CODE);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::TYPE);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::TITLE);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::SHORT_DESCRIPTION);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::DESCRIPTION);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::VALUE);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::IS_USED);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::IS_ENABLED);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::EXPIRATION_DATE);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::SERIALIZED_RULES);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::UPDATED_AT);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::VERSION);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.CODE');
|
||||
$criteria->addSelectColumn($alias . '.TYPE');
|
||||
$criteria->addSelectColumn($alias . '.TITLE');
|
||||
$criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.VALUE');
|
||||
$criteria->addSelectColumn($alias . '.IS_USED');
|
||||
$criteria->addSelectColumn($alias . '.IS_ENABLED');
|
||||
$criteria->addSelectColumn($alias . '.EXPIRATION_DATE');
|
||||
$criteria->addSelectColumn($alias . '.SERIALIZED_RULES');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.VERSION');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(CouponVersionTableMap::DATABASE_NAME)->getTable(CouponVersionTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponVersionTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(CouponVersionTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new CouponVersionTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a CouponVersion or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or CouponVersion 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 static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponVersionTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\CouponVersion) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(CouponVersionTableMap::DATABASE_NAME);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey values
|
||||
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
$criterion = $criteria->getNewCriterion(CouponVersionTableMap::ID, $value[0]);
|
||||
$criterion->addAnd($criteria->getNewCriterion(CouponVersionTableMap::VERSION, $value[1]));
|
||||
$criteria->addOr($criterion);
|
||||
}
|
||||
}
|
||||
|
||||
$query = CouponVersionQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { CouponVersionTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { CouponVersionTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return CouponVersionQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a CouponVersion or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or CouponVersion object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(CouponVersionTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from CouponVersion object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = CouponVersionQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // CouponVersionTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
CouponVersionTableMap::buildTableMap();
|
||||
456
core/lib/Thelia/Model/Map/ProductAssociatedContentTableMap.php
Normal file
456
core/lib/Thelia/Model/Map/ProductAssociatedContentTableMap.php
Normal file
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\ProductAssociatedContent;
|
||||
use Thelia\Model\ProductAssociatedContentQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'product_associated_content' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class ProductAssociatedContentTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.ProductAssociatedContentTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'product_associated_content';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\ProductAssociatedContent';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.ProductAssociatedContent';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 6;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 6;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'product_associated_content.ID';
|
||||
|
||||
/**
|
||||
* the column name for the PRODUCT_ID field
|
||||
*/
|
||||
const PRODUCT_ID = 'product_associated_content.PRODUCT_ID';
|
||||
|
||||
/**
|
||||
* the column name for the CONTENT_ID field
|
||||
*/
|
||||
const CONTENT_ID = 'product_associated_content.CONTENT_ID';
|
||||
|
||||
/**
|
||||
* the column name for the POSITION field
|
||||
*/
|
||||
const POSITION = 'product_associated_content.POSITION';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
const CREATED_AT = 'product_associated_content.CREATED_AT';
|
||||
|
||||
/**
|
||||
* the column name for the UPDATED_AT field
|
||||
*/
|
||||
const UPDATED_AT = 'product_associated_content.UPDATED_AT';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'ProductId', 'ContentId', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'contentId', 'position', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ProductAssociatedContentTableMap::ID, ProductAssociatedContentTableMap::PRODUCT_ID, ProductAssociatedContentTableMap::CONTENT_ID, ProductAssociatedContentTableMap::POSITION, ProductAssociatedContentTableMap::CREATED_AT, ProductAssociatedContentTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'CONTENT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'product_id', 'content_id', 'position', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'ContentId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'contentId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
|
||||
self::TYPE_COLNAME => array(ProductAssociatedContentTableMap::ID => 0, ProductAssociatedContentTableMap::PRODUCT_ID => 1, ProductAssociatedContentTableMap::CONTENT_ID => 2, ProductAssociatedContentTableMap::POSITION => 3, ProductAssociatedContentTableMap::CREATED_AT => 4, ProductAssociatedContentTableMap::UPDATED_AT => 5, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'CONTENT_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'content_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('product_associated_content');
|
||||
$this->setPhpName('ProductAssociatedContent');
|
||||
$this->setClassName('\\Thelia\\Model\\ProductAssociatedContent');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null);
|
||||
$this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', true, null, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Content', '\\Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return (int) $row[
|
||||
$indexType == TableMap::TYPE_NUM
|
||||
? 0 + $offset
|
||||
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? ProductAssociatedContentTableMap::CLASS_DEFAULT : ProductAssociatedContentTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (ProductAssociatedContent object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ProductAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ProductAssociatedContentTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + ProductAssociatedContentTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ProductAssociatedContentTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ProductAssociatedContentTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = ProductAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ProductAssociatedContentTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
ProductAssociatedContentTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(ProductAssociatedContentTableMap::ID);
|
||||
$criteria->addSelectColumn(ProductAssociatedContentTableMap::PRODUCT_ID);
|
||||
$criteria->addSelectColumn(ProductAssociatedContentTableMap::CONTENT_ID);
|
||||
$criteria->addSelectColumn(ProductAssociatedContentTableMap::POSITION);
|
||||
$criteria->addSelectColumn(ProductAssociatedContentTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(ProductAssociatedContentTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.PRODUCT_ID');
|
||||
$criteria->addSelectColumn($alias . '.CONTENT_ID');
|
||||
$criteria->addSelectColumn($alias . '.POSITION');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(ProductAssociatedContentTableMap::DATABASE_NAME)->getTable(ProductAssociatedContentTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ProductAssociatedContentTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ProductAssociatedContentTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ProductAssociatedContentTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ProductAssociatedContent or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ProductAssociatedContent 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 static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(ProductAssociatedContentTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\ProductAssociatedContent) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(ProductAssociatedContentTableMap::DATABASE_NAME);
|
||||
$criteria->add(ProductAssociatedContentTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ProductAssociatedContentQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ProductAssociatedContentTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ProductAssociatedContentTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return ProductAssociatedContentQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ProductAssociatedContent or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ProductAssociatedContent object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(ProductAssociatedContentTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ProductAssociatedContent object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(ProductAssociatedContentTableMap::ID) && $criteria->keyContainsValue(ProductAssociatedContentTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ProductAssociatedContentTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ProductAssociatedContentQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // ProductAssociatedContentTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ProductAssociatedContentTableMap::buildTableMap();
|
||||
9
core/lib/Thelia/Model/ProductAssociatedContent.php
Normal file
9
core/lib/Thelia/Model/ProductAssociatedContent.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\ProductAssociatedContent as BaseProductAssociatedContent;
|
||||
|
||||
class ProductAssociatedContent extends BaseProductAssociatedContent {
|
||||
|
||||
}
|
||||
20
core/lib/Thelia/Model/ProductAssociatedContentQuery.php
Normal file
20
core/lib/Thelia/Model/ProductAssociatedContentQuery.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\ProductAssociatedContentQuery as BaseProductAssociatedContentQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'product_associated_content' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class ProductAssociatedContentQuery extends BaseProductAssociatedContentQuery {
|
||||
|
||||
} // ProductAssociatedContentQuery
|
||||
@@ -20,7 +20,15 @@ $currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne(
|
||||
try {
|
||||
$stmt = $con->prepare("SET foreign_key_checks = 0");
|
||||
$stmt->execute();
|
||||
|
||||
|
||||
$productAssociatedContent = Thelia\Model\ProductAssociatedContentQuery::create()
|
||||
->find();
|
||||
$productAssociatedContent->delete();
|
||||
|
||||
$categoryAssociatedContent = Thelia\Model\CategoryAssociatedContentQuery::create()
|
||||
->find();
|
||||
$categoryAssociatedContent->delete();
|
||||
|
||||
$attributeCategory = Thelia\Model\AttributeCategoryQuery::create()
|
||||
->find();
|
||||
$attributeCategory->delete();
|
||||
@@ -183,14 +191,60 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
//folders and contents
|
||||
$contentIdList = array();
|
||||
for($i=0; $i<4; $i++) {
|
||||
$folder = new Thelia\Model\Folder();
|
||||
$folder->setParent(0);
|
||||
$folder->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$folder->setPosition($i);
|
||||
setI18n($faker, $folder);
|
||||
|
||||
$folder->save();
|
||||
|
||||
$image = new FolderImage();
|
||||
$image->setFolderId($folder->getId());
|
||||
generate_image($image, 1, 'folder', $folder->getId());
|
||||
|
||||
for($j=1; $j<rand(0, 5); $j++) {
|
||||
$subfolder = new Thelia\Model\Folder();
|
||||
$subfolder->setParent($folder->getId());
|
||||
$subfolder->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$subfolder->setPosition($j);
|
||||
setI18n($faker, $subfolder);
|
||||
|
||||
$subfolder->save();
|
||||
|
||||
$image = new FolderImage();
|
||||
$image->setFolderId($subfolder->getId());
|
||||
generate_image($image, 1, 'folder', $subfolder->getId());
|
||||
|
||||
for($k=0; $k<rand(0, 5); $k++) {
|
||||
$content = new Thelia\Model\Content();
|
||||
$content->addFolder($subfolder);
|
||||
$content->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$content->setPosition($k);
|
||||
setI18n($faker, $content);
|
||||
|
||||
$content->save();
|
||||
$contentId = $content->getId();
|
||||
$contentIdList[] = $contentId;
|
||||
|
||||
$image = new ContentImage();
|
||||
$image->setContentId($content->getId());
|
||||
generate_image($image, 1, 'content', $contentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//categories and products
|
||||
$productIdList = array();
|
||||
$categoryIdList = array();
|
||||
for($i=0; $i<4; $i++) {
|
||||
$category = createCategory($faker, 0, $i, $categoryIdList);
|
||||
$category = createCategory($faker, 0, $i, $categoryIdList, $contentIdList);
|
||||
|
||||
for($j=1; $j<rand(0, 5); $j++) {
|
||||
$subcategory = createCategory($faker, $category->getId(), $j, $categoryIdList);
|
||||
$subcategory = createCategory($faker, $category->getId(), $j, $categoryIdList, $contentIdList);
|
||||
|
||||
for($k=0; $k<rand(0, 5); $k++) {
|
||||
createProduct($faker, $subcategory, $k, $productIdList);
|
||||
@@ -235,6 +289,22 @@ try {
|
||||
->save();
|
||||
}
|
||||
|
||||
//add random associated content
|
||||
$alreadyPicked = array();
|
||||
for($i=1; $i<rand(0, 3); $i++) {
|
||||
$productAssociatedContent = new Thelia\Model\ProductAssociatedContent();
|
||||
do {
|
||||
$pick = array_rand($contentIdList, 1);
|
||||
} while(in_array($pick, $alreadyPicked));
|
||||
|
||||
$alreadyPicked[] = $pick;
|
||||
|
||||
$productAssociatedContent->setContentId($contentIdList[$pick])
|
||||
->setProductId($productId)
|
||||
->setPosition($i)
|
||||
->save();
|
||||
}
|
||||
|
||||
//associate PSE and stocks to products
|
||||
for($i=0; $i<rand(1,7); $i++) {
|
||||
$stock = new \Thelia\Model\ProductSaleElements();
|
||||
@@ -270,11 +340,6 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach($attributeList as $attributeId => $attributeAvId) {
|
||||
|
||||
}
|
||||
|
||||
//associate features to products
|
||||
foreach($featureList as $featureId => $featureAvId) {
|
||||
$featureProduct = new Thelia\Model\FeatureProduct();
|
||||
@@ -293,49 +358,6 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
//folders and contents
|
||||
for($i=0; $i<4; $i++) {
|
||||
$folder = new Thelia\Model\Folder();
|
||||
$folder->setParent(0);
|
||||
$folder->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$folder->setPosition($i);
|
||||
setI18n($faker, $folder);
|
||||
|
||||
$folder->save();
|
||||
|
||||
$image = new FolderImage();
|
||||
$image->setFolderId($folder->getId());
|
||||
generate_image($image, 1, 'folder', $folder->getId());
|
||||
|
||||
for($j=1; $j<rand(0, 5); $j++) {
|
||||
$subfolder = new Thelia\Model\Folder();
|
||||
$subfolder->setParent($folder->getId());
|
||||
$subfolder->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$subfolder->setPosition($j);
|
||||
setI18n($faker, $subfolder);
|
||||
|
||||
$subfolder->save();
|
||||
|
||||
$image = new FolderImage();
|
||||
$image->setFolderId($subfolder->getId());
|
||||
generate_image($image, 1, 'folder', $subfolder->getId());
|
||||
|
||||
for($k=0; $k<rand(0, 5); $k++) {
|
||||
$content = new Thelia\Model\Content();
|
||||
$content->addFolder($subfolder);
|
||||
$content->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$content->setPosition($k);
|
||||
setI18n($faker, $content);
|
||||
|
||||
$content->save();
|
||||
|
||||
$image = new ContentImage();
|
||||
$image->setContentId($content->getId());
|
||||
generate_image($image, 1, 'content', $content->getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
echo "error : ".$e->getMessage()."\n";
|
||||
@@ -362,7 +384,7 @@ function createProduct($faker, $category, $position, &$productIdList)
|
||||
return $product;
|
||||
}
|
||||
|
||||
function createCategory($faker, $parent, $position, &$categoryIdList)
|
||||
function createCategory($faker, $parent, $position, &$categoryIdList, $contentIdList)
|
||||
{
|
||||
$category = new Thelia\Model\Category();
|
||||
$category->setParent($parent);
|
||||
@@ -371,12 +393,28 @@ function createCategory($faker, $parent, $position, &$categoryIdList)
|
||||
setI18n($faker, $category);
|
||||
|
||||
$category->save();
|
||||
$cateogoryId = $category->getId();
|
||||
$categoryIdList[] = $cateogoryId;
|
||||
$categoryId = $category->getId();
|
||||
$categoryIdList[] = $categoryId;
|
||||
|
||||
//add random associated content
|
||||
$alreadyPicked = array();
|
||||
for($i=1; $i<rand(0, 3); $i++) {
|
||||
$categoryAssociatedContent = new Thelia\Model\CategoryAssociatedContent();
|
||||
do {
|
||||
$pick = array_rand($contentIdList, 1);
|
||||
} while(in_array($pick, $alreadyPicked));
|
||||
|
||||
$alreadyPicked[] = $pick;
|
||||
|
||||
$categoryAssociatedContent->setContentId($contentIdList[$pick])
|
||||
->setCategoryId($categoryId)
|
||||
->setPosition($i)
|
||||
->save();
|
||||
}
|
||||
|
||||
$image = new CategoryImage();
|
||||
$image->setCategoryId($cateogoryId);
|
||||
generate_image($image, 1, 'category', $cateogoryId);
|
||||
$image->setCategoryId($categoryId);
|
||||
generate_image($image, 1, 'category', $categoryId);
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
2
install/sqldb.map
Normal file
2
install/sqldb.map
Normal file
@@ -0,0 +1,2 @@
|
||||
# Sqlfile -> Database map
|
||||
thelia.sql=thelia
|
||||
@@ -7,11 +7,25 @@
|
||||
{loop name="category0" type="category" parent="0" order="manual"}
|
||||
<div style="border: solid 4px blue; padding: 20px; margin: 10px;">
|
||||
<h2>CATEGORY : #TITLE (#LOOP_COUNT / #LOOP_TOTAL)</h2>
|
||||
|
||||
{ifloop rel="prod_ass_cont"}
|
||||
<h5>Associated Content</h5>
|
||||
<ul>
|
||||
{loop name="prod_ass_cont" type="associated_content" category="#ID" order="associated_content"}
|
||||
<li>#TITLE</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
{/ifloop}
|
||||
{elseloop rel="prod_ass_cont"}
|
||||
<h5>No associated content</h5>
|
||||
{/elseloop}
|
||||
|
||||
{loop name="product" type="product" category="#ID"}
|
||||
<div style="border: dashed 2px red; padding: 20px; margin: 10px;">
|
||||
<h3><a name="#REF">PRODUCT : #REF (#LOOP_COUNT / #LOOP_TOTAL)</a></h3>
|
||||
<h4>#TITLE</h4>
|
||||
<p>#DESCRIPTION</p>
|
||||
|
||||
{ifloop rel="acc"}
|
||||
<h5>Accessories</h5>
|
||||
<ul>
|
||||
@@ -23,6 +37,19 @@
|
||||
{elseloop rel="acc"}
|
||||
<h5>No accessory</h5>
|
||||
{/elseloop}
|
||||
|
||||
{ifloop rel="prod_ass_cont"}
|
||||
<h5>Associated Content</h5>
|
||||
<ul>
|
||||
{loop name="prod_ass_cont" type="associated_content" product="#ID" order="associated_content"}
|
||||
<li>#TITLE</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
{/ifloop}
|
||||
{elseloop rel="prod_ass_cont"}
|
||||
<h5>No associated content</h5>
|
||||
{/elseloop}
|
||||
|
||||
{ifloop rel="ft"}
|
||||
<h5>Features</h5>
|
||||
<ul>
|
||||
@@ -40,7 +67,7 @@
|
||||
{elseloop rel="ft"}
|
||||
<h5>No feature</h5>
|
||||
{/elseloop}
|
||||
{ifloop rel="pse"}
|
||||
|
||||
<h5>Product sale elements</h5>
|
||||
|
||||
{assign var=current_product value=#ID}
|
||||
@@ -62,20 +89,32 @@
|
||||
</ul>
|
||||
</div>
|
||||
{/loop}
|
||||
{/ifloop}
|
||||
{elseloop rel="ft"}
|
||||
<h5>No feature</h5>
|
||||
{/elseloop}
|
||||
|
||||
</div>
|
||||
{/loop}
|
||||
{loop name="catgory1" type="category" parent="#ID"}
|
||||
<div style="border: double 4px lightseagreen; padding: 20px; margin: 10px;">
|
||||
<h3>SUBCATEGORY : #TITLE (#LOOP_COUNT / #LOOP_TOTAL)</h3>
|
||||
|
||||
{ifloop rel="prod_ass_cont"}
|
||||
<h5>Associated Content</h5>
|
||||
<ul>
|
||||
{loop name="prod_ass_cont" type="associated_content" category="#ID" order="associated_content"}
|
||||
<li>#TITLE</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
{/ifloop}
|
||||
{elseloop rel="prod_ass_cont"}
|
||||
<h5>No associated content</h5>
|
||||
{/elseloop}
|
||||
|
||||
{loop name="product" type="product" category="#ID"}
|
||||
|
||||
<div style="border: solid 1px green; padding: 20px; margin: 10px;">
|
||||
<h3><a name="#REF">PRODUCT : #REF (#LOOP_COUNT / #LOOP_TOTAL)</a></h3>
|
||||
<h4>#TITLE</h4>
|
||||
<p>#DESCRIPTION</p>
|
||||
|
||||
{ifloop rel="acc"}
|
||||
<h5>Accessories</h5>
|
||||
<ul>
|
||||
@@ -87,6 +126,19 @@
|
||||
{elseloop rel="acc"}
|
||||
<h5>No accessory</h5>
|
||||
{/elseloop}
|
||||
|
||||
{ifloop rel="prod_ass_cont"}
|
||||
<h5>Associated Content</h5>
|
||||
<ul>
|
||||
{loop name="prod_ass_cont" type="associated_content" product="#ID" order="associated_content"}
|
||||
<li>#TITLE</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
{/ifloop}
|
||||
{elseloop rel="prod_ass_cont"}
|
||||
<h5>No associated content</h5>
|
||||
{/elseloop}
|
||||
|
||||
{ifloop rel="ft"}
|
||||
<h5>Features</h5>
|
||||
<ul>
|
||||
@@ -103,6 +155,29 @@
|
||||
{elseloop rel="ft"}
|
||||
<h5>No feature</h5>
|
||||
{/elseloop}
|
||||
|
||||
<h5>Product sale elements</h5>
|
||||
|
||||
{assign var=current_product value=#ID}
|
||||
{loop name="pse" type="product_sale_elements" product="#ID"}
|
||||
<div style="border: solid 2px darkorange; padding: 5px; margin: 5px;">
|
||||
{loop name="combi" type="attribute_combination" product_sale_element="#ID"}
|
||||
#ATTRIBUTE_TITLE = #ATTRIBUTE_AVAILABILITY_TITLE<br />
|
||||
{/loop}
|
||||
<br />#WEIGHT g
|
||||
<br /><strong>{if #IS_PROMO == 1} #PROMO_PRICE € (instead of #PRICE) {else} #PRICE € {/if}</strong>
|
||||
<br /><br />
|
||||
Add
|
||||
<select>
|
||||
{for $will=1 to #QUANTITY}
|
||||
<option>{$will}</option>
|
||||
{/for}
|
||||
</select>
|
||||
to my cart
|
||||
</ul>
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user