add Propel generated files

This commit is contained in:
Manuel Raynaud
2013-01-16 10:58:36 +01:00
parent 59e2b29e6a
commit c72c13551c
494 changed files with 251990 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,653 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Accessory;
use Thelia\Model\AccessoryPeer;
use Thelia\Model\AccessoryQuery;
use Thelia\Model\Product;
/**
* Base class that represents a query for the 'accessory' table.
*
*
*
* @method AccessoryQuery orderById($order = Criteria::ASC) Order by the id column
* @method AccessoryQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
* @method AccessoryQuery orderByAccessory($order = Criteria::ASC) Order by the accessory column
* @method AccessoryQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method AccessoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AccessoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AccessoryQuery groupById() Group by the id column
* @method AccessoryQuery groupByProductId() Group by the product_id column
* @method AccessoryQuery groupByAccessory() Group by the accessory column
* @method AccessoryQuery groupByPosition() Group by the position column
* @method AccessoryQuery groupByCreatedAt() Group by the created_at column
* @method AccessoryQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AccessoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AccessoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AccessoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AccessoryQuery leftJoinProductRelatedByProductId($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductRelatedByProductId relation
* @method AccessoryQuery rightJoinProductRelatedByProductId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductRelatedByProductId relation
* @method AccessoryQuery innerJoinProductRelatedByProductId($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductRelatedByProductId relation
*
* @method AccessoryQuery leftJoinProductRelatedByAccessory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductRelatedByAccessory relation
* @method AccessoryQuery rightJoinProductRelatedByAccessory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductRelatedByAccessory relation
* @method AccessoryQuery innerJoinProductRelatedByAccessory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductRelatedByAccessory relation
*
* @method Accessory findOne(PropelPDO $con = null) Return the first Accessory matching the query
* @method Accessory findOneOrCreate(PropelPDO $con = null) Return the first Accessory matching the query, or a new Accessory object populated from the query conditions when no match is found
*
* @method Accessory findOneById(int $id) Return the first Accessory filtered by the id column
* @method Accessory findOneByProductId(int $product_id) Return the first Accessory filtered by the product_id column
* @method Accessory findOneByAccessory(int $accessory) Return the first Accessory filtered by the accessory column
* @method Accessory findOneByPosition(int $position) Return the first Accessory filtered by the position column
* @method Accessory findOneByCreatedAt(string $created_at) Return the first Accessory filtered by the created_at column
* @method Accessory findOneByUpdatedAt(string $updated_at) Return the first Accessory filtered by the updated_at column
*
* @method array findById(int $id) Return Accessory objects filtered by the id column
* @method array findByProductId(int $product_id) Return Accessory objects filtered by the product_id column
* @method array findByAccessory(int $accessory) Return Accessory objects filtered by the accessory column
* @method array findByPosition(int $position) Return Accessory objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return Accessory objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Accessory objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAccessoryQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAccessoryQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Accessory', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AccessoryQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AccessoryQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AccessoryQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AccessoryQuery) {
return $criteria;
}
$query = new AccessoryQuery();
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 PropelPDO $con an optional connection object
*
* @return Accessory|Accessory[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AccessoryPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AccessoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Accessory A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `PRODUCT_ID`, `ACCESSORY`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `accessory` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Accessory();
$obj->hydrate($row);
AccessoryPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Accessory|Accessory[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Accessory[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AccessoryQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AccessoryPeer::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 AccessoryQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AccessoryPeer::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 AccessoryQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AccessoryPeer::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 filterByProductRelatedByProductId()
*
* @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 AccessoryQuery 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(AccessoryPeer::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($productId['max'])) {
$this->addUsingAlias(AccessoryPeer::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AccessoryPeer::PRODUCT_ID, $productId, $comparison);
}
/**
* Filter the query on the accessory column
*
* Example usage:
* <code>
* $query->filterByAccessory(1234); // WHERE accessory = 1234
* $query->filterByAccessory(array(12, 34)); // WHERE accessory IN (12, 34)
* $query->filterByAccessory(array('min' => 12)); // WHERE accessory > 12
* </code>
*
* @see filterByProductRelatedByAccessory()
*
* @param mixed $accessory 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 AccessoryQuery The current query, for fluid interface
*/
public function filterByAccessory($accessory = null, $comparison = null)
{
if (is_array($accessory)) {
$useMinMax = false;
if (isset($accessory['min'])) {
$this->addUsingAlias(AccessoryPeer::ACCESSORY, $accessory['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($accessory['max'])) {
$this->addUsingAlias(AccessoryPeer::ACCESSORY, $accessory['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AccessoryPeer::ACCESSORY, $accessory, $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 AccessoryQuery 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(AccessoryPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(AccessoryPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AccessoryPeer::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 AccessoryQuery 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(AccessoryPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AccessoryPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AccessoryPeer::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 AccessoryQuery 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(AccessoryPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AccessoryPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AccessoryPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Product object
*
* @param Product|PropelObjectCollection $product The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AccessoryQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByProductRelatedByProductId($product, $comparison = null)
{
if ($product instanceof Product) {
return $this
->addUsingAlias(AccessoryPeer::PRODUCT_ID, $product->getId(), $comparison);
} elseif ($product instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AccessoryPeer::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByProductRelatedByProductId() only accepts arguments of type Product or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the ProductRelatedByProductId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AccessoryQuery The current query, for fluid interface
*/
public function joinProductRelatedByProductId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ProductRelatedByProductId');
// 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, 'ProductRelatedByProductId');
}
return $this;
}
/**
* Use the ProductRelatedByProductId 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 useProductRelatedByProductIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinProductRelatedByProductId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ProductRelatedByProductId', '\Thelia\Model\ProductQuery');
}
/**
* Filter the query by a related Product object
*
* @param Product|PropelObjectCollection $product The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AccessoryQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByProductRelatedByAccessory($product, $comparison = null)
{
if ($product instanceof Product) {
return $this
->addUsingAlias(AccessoryPeer::ACCESSORY, $product->getId(), $comparison);
} elseif ($product instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AccessoryPeer::ACCESSORY, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByProductRelatedByAccessory() only accepts arguments of type Product or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the ProductRelatedByAccessory relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AccessoryQuery The current query, for fluid interface
*/
public function joinProductRelatedByAccessory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ProductRelatedByAccessory');
// 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, 'ProductRelatedByAccessory');
}
return $this;
}
/**
* Use the ProductRelatedByAccessory 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 useProductRelatedByAccessoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinProductRelatedByAccessory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ProductRelatedByAccessory', '\Thelia\Model\ProductQuery');
}
/**
* Exclude object from result
*
* @param Accessory $accessory Object to remove from the list of results
*
* @return AccessoryQuery The current query, for fluid interface
*/
public function prune($accessory = null)
{
if ($accessory) {
$this->addUsingAlias(AccessoryPeer::ID, $accessory->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,984 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Address;
use Thelia\Model\AddressPeer;
use Thelia\Model\AddressQuery;
use Thelia\Model\Customer;
use Thelia\Model\CustomerTitle;
/**
* Base class that represents a query for the 'address' table.
*
*
*
* @method AddressQuery orderById($order = Criteria::ASC) Order by the id column
* @method AddressQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method AddressQuery orderByCustomerId($order = Criteria::ASC) Order by the customer_id column
* @method AddressQuery orderByCustomerTitleId($order = Criteria::ASC) Order by the customer_title_id column
* @method AddressQuery orderByCompany($order = Criteria::ASC) Order by the company column
* @method AddressQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
* @method AddressQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
* @method AddressQuery orderByAddress1($order = Criteria::ASC) Order by the address1 column
* @method AddressQuery orderByAddress2($order = Criteria::ASC) Order by the address2 column
* @method AddressQuery orderByAddress3($order = Criteria::ASC) Order by the address3 column
* @method AddressQuery orderByZipcode($order = Criteria::ASC) Order by the zipcode column
* @method AddressQuery orderByCity($order = Criteria::ASC) Order by the city column
* @method AddressQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
* @method AddressQuery orderByPhone($order = Criteria::ASC) Order by the phone column
* @method AddressQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AddressQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AddressQuery groupById() Group by the id column
* @method AddressQuery groupByTitle() Group by the title column
* @method AddressQuery groupByCustomerId() Group by the customer_id column
* @method AddressQuery groupByCustomerTitleId() Group by the customer_title_id column
* @method AddressQuery groupByCompany() Group by the company column
* @method AddressQuery groupByFirstname() Group by the firstname column
* @method AddressQuery groupByLastname() Group by the lastname column
* @method AddressQuery groupByAddress1() Group by the address1 column
* @method AddressQuery groupByAddress2() Group by the address2 column
* @method AddressQuery groupByAddress3() Group by the address3 column
* @method AddressQuery groupByZipcode() Group by the zipcode column
* @method AddressQuery groupByCity() Group by the city column
* @method AddressQuery groupByCountryId() Group by the country_id column
* @method AddressQuery groupByPhone() Group by the phone column
* @method AddressQuery groupByCreatedAt() Group by the created_at column
* @method AddressQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AddressQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AddressQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AddressQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AddressQuery leftJoinCustomer($relationAlias = null) Adds a LEFT JOIN clause to the query using the Customer relation
* @method AddressQuery rightJoinCustomer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Customer relation
* @method AddressQuery innerJoinCustomer($relationAlias = null) Adds a INNER JOIN clause to the query using the Customer relation
*
* @method AddressQuery leftJoinCustomerTitle($relationAlias = null) Adds a LEFT JOIN clause to the query using the CustomerTitle relation
* @method AddressQuery rightJoinCustomerTitle($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CustomerTitle relation
* @method AddressQuery innerJoinCustomerTitle($relationAlias = null) Adds a INNER JOIN clause to the query using the CustomerTitle relation
*
* @method Address findOne(PropelPDO $con = null) Return the first Address matching the query
* @method Address findOneOrCreate(PropelPDO $con = null) Return the first Address matching the query, or a new Address object populated from the query conditions when no match is found
*
* @method Address findOneById(int $id) Return the first Address filtered by the id column
* @method Address findOneByTitle(string $title) Return the first Address filtered by the title column
* @method Address findOneByCustomerId(int $customer_id) Return the first Address filtered by the customer_id column
* @method Address findOneByCustomerTitleId(int $customer_title_id) Return the first Address filtered by the customer_title_id column
* @method Address findOneByCompany(string $company) Return the first Address filtered by the company column
* @method Address findOneByFirstname(string $firstname) Return the first Address filtered by the firstname column
* @method Address findOneByLastname(string $lastname) Return the first Address filtered by the lastname column
* @method Address findOneByAddress1(string $address1) Return the first Address filtered by the address1 column
* @method Address findOneByAddress2(string $address2) Return the first Address filtered by the address2 column
* @method Address findOneByAddress3(string $address3) Return the first Address filtered by the address3 column
* @method Address findOneByZipcode(string $zipcode) Return the first Address filtered by the zipcode column
* @method Address findOneByCity(string $city) Return the first Address filtered by the city column
* @method Address findOneByCountryId(int $country_id) Return the first Address filtered by the country_id column
* @method Address findOneByPhone(string $phone) Return the first Address filtered by the phone column
* @method Address findOneByCreatedAt(string $created_at) Return the first Address filtered by the created_at column
* @method Address findOneByUpdatedAt(string $updated_at) Return the first Address filtered by the updated_at column
*
* @method array findById(int $id) Return Address objects filtered by the id column
* @method array findByTitle(string $title) Return Address objects filtered by the title column
* @method array findByCustomerId(int $customer_id) Return Address objects filtered by the customer_id column
* @method array findByCustomerTitleId(int $customer_title_id) Return Address objects filtered by the customer_title_id column
* @method array findByCompany(string $company) Return Address objects filtered by the company column
* @method array findByFirstname(string $firstname) Return Address objects filtered by the firstname column
* @method array findByLastname(string $lastname) Return Address objects filtered by the lastname column
* @method array findByAddress1(string $address1) Return Address objects filtered by the address1 column
* @method array findByAddress2(string $address2) Return Address objects filtered by the address2 column
* @method array findByAddress3(string $address3) Return Address objects filtered by the address3 column
* @method array findByZipcode(string $zipcode) Return Address objects filtered by the zipcode column
* @method array findByCity(string $city) Return Address objects filtered by the city column
* @method array findByCountryId(int $country_id) Return Address objects filtered by the country_id column
* @method array findByPhone(string $phone) Return Address objects filtered by the phone column
* @method array findByCreatedAt(string $created_at) Return Address objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Address objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAddressQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAddressQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Address', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AddressQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AddressQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AddressQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AddressQuery) {
return $criteria;
}
$query = new AddressQuery();
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 PropelPDO $con an optional connection object
*
* @return Address|Address[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AddressPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Address A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `TITLE`, `CUSTOMER_ID`, `CUSTOMER_TITLE_ID`, `COMPANY`, `FIRSTNAME`, `LASTNAME`, `ADDRESS1`, `ADDRESS2`, `ADDRESS3`, `ZIPCODE`, `CITY`, `COUNTRY_ID`, `PHONE`, `CREATED_AT`, `UPDATED_AT` FROM `address` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Address();
$obj->hydrate($row);
AddressPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Address|Address[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Address[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AddressQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AddressPeer::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 AddressQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AddressPeer::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 AddressQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AddressPeer::ID, $id, $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 AddressQuery 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(AddressPeer::TITLE, $title, $comparison);
}
/**
* Filter the query on the customer_id column
*
* Example usage:
* <code>
* $query->filterByCustomerId(1234); // WHERE customer_id = 1234
* $query->filterByCustomerId(array(12, 34)); // WHERE customer_id IN (12, 34)
* $query->filterByCustomerId(array('min' => 12)); // WHERE customer_id > 12
* </code>
*
* @see filterByCustomer()
*
* @param mixed $customerId 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 AddressQuery The current query, for fluid interface
*/
public function filterByCustomerId($customerId = null, $comparison = null)
{
if (is_array($customerId)) {
$useMinMax = false;
if (isset($customerId['min'])) {
$this->addUsingAlias(AddressPeer::CUSTOMER_ID, $customerId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($customerId['max'])) {
$this->addUsingAlias(AddressPeer::CUSTOMER_ID, $customerId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AddressPeer::CUSTOMER_ID, $customerId, $comparison);
}
/**
* Filter the query on the customer_title_id column
*
* Example usage:
* <code>
* $query->filterByCustomerTitleId(1234); // WHERE customer_title_id = 1234
* $query->filterByCustomerTitleId(array(12, 34)); // WHERE customer_title_id IN (12, 34)
* $query->filterByCustomerTitleId(array('min' => 12)); // WHERE customer_title_id > 12
* </code>
*
* @see filterByCustomerTitle()
*
* @param mixed $customerTitleId 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 AddressQuery The current query, for fluid interface
*/
public function filterByCustomerTitleId($customerTitleId = null, $comparison = null)
{
if (is_array($customerTitleId)) {
$useMinMax = false;
if (isset($customerTitleId['min'])) {
$this->addUsingAlias(AddressPeer::CUSTOMER_TITLE_ID, $customerTitleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($customerTitleId['max'])) {
$this->addUsingAlias(AddressPeer::CUSTOMER_TITLE_ID, $customerTitleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AddressPeer::CUSTOMER_TITLE_ID, $customerTitleId, $comparison);
}
/**
* Filter the query on the company column
*
* Example usage:
* <code>
* $query->filterByCompany('fooValue'); // WHERE company = 'fooValue'
* $query->filterByCompany('%fooValue%'); // WHERE company LIKE '%fooValue%'
* </code>
*
* @param string $company 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 AddressQuery The current query, for fluid interface
*/
public function filterByCompany($company = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($company)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $company)) {
$company = str_replace('*', '%', $company);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressPeer::COMPANY, $company, $comparison);
}
/**
* Filter the query on the firstname column
*
* Example usage:
* <code>
* $query->filterByFirstname('fooValue'); // WHERE firstname = 'fooValue'
* $query->filterByFirstname('%fooValue%'); // WHERE firstname LIKE '%fooValue%'
* </code>
*
* @param string $firstname 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 AddressQuery The current query, for fluid interface
*/
public function filterByFirstname($firstname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($firstname)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $firstname)) {
$firstname = str_replace('*', '%', $firstname);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressPeer::FIRSTNAME, $firstname, $comparison);
}
/**
* Filter the query on the lastname column
*
* Example usage:
* <code>
* $query->filterByLastname('fooValue'); // WHERE lastname = 'fooValue'
* $query->filterByLastname('%fooValue%'); // WHERE lastname LIKE '%fooValue%'
* </code>
*
* @param string $lastname 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 AddressQuery The current query, for fluid interface
*/
public function filterByLastname($lastname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lastname)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lastname)) {
$lastname = str_replace('*', '%', $lastname);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressPeer::LASTNAME, $lastname, $comparison);
}
/**
* Filter the query on the address1 column
*
* Example usage:
* <code>
* $query->filterByAddress1('fooValue'); // WHERE address1 = 'fooValue'
* $query->filterByAddress1('%fooValue%'); // WHERE address1 LIKE '%fooValue%'
* </code>
*
* @param string $address1 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 AddressQuery The current query, for fluid interface
*/
public function filterByAddress1($address1 = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($address1)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $address1)) {
$address1 = str_replace('*', '%', $address1);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressPeer::ADDRESS1, $address1, $comparison);
}
/**
* Filter the query on the address2 column
*
* Example usage:
* <code>
* $query->filterByAddress2('fooValue'); // WHERE address2 = 'fooValue'
* $query->filterByAddress2('%fooValue%'); // WHERE address2 LIKE '%fooValue%'
* </code>
*
* @param string $address2 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 AddressQuery The current query, for fluid interface
*/
public function filterByAddress2($address2 = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($address2)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $address2)) {
$address2 = str_replace('*', '%', $address2);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressPeer::ADDRESS2, $address2, $comparison);
}
/**
* Filter the query on the address3 column
*
* Example usage:
* <code>
* $query->filterByAddress3('fooValue'); // WHERE address3 = 'fooValue'
* $query->filterByAddress3('%fooValue%'); // WHERE address3 LIKE '%fooValue%'
* </code>
*
* @param string $address3 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 AddressQuery The current query, for fluid interface
*/
public function filterByAddress3($address3 = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($address3)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $address3)) {
$address3 = str_replace('*', '%', $address3);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressPeer::ADDRESS3, $address3, $comparison);
}
/**
* Filter the query on the zipcode column
*
* Example usage:
* <code>
* $query->filterByZipcode('fooValue'); // WHERE zipcode = 'fooValue'
* $query->filterByZipcode('%fooValue%'); // WHERE zipcode LIKE '%fooValue%'
* </code>
*
* @param string $zipcode 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 AddressQuery The current query, for fluid interface
*/
public function filterByZipcode($zipcode = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($zipcode)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $zipcode)) {
$zipcode = str_replace('*', '%', $zipcode);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressPeer::ZIPCODE, $zipcode, $comparison);
}
/**
* Filter the query on the city column
*
* Example usage:
* <code>
* $query->filterByCity('fooValue'); // WHERE city = 'fooValue'
* $query->filterByCity('%fooValue%'); // WHERE city LIKE '%fooValue%'
* </code>
*
* @param string $city 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 AddressQuery The current query, for fluid interface
*/
public function filterByCity($city = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($city)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $city)) {
$city = str_replace('*', '%', $city);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressPeer::CITY, $city, $comparison);
}
/**
* Filter the query on the country_id column
*
* Example usage:
* <code>
* $query->filterByCountryId(1234); // WHERE country_id = 1234
* $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
* $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
* </code>
*
* @param mixed $countryId 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 AddressQuery The current query, for fluid interface
*/
public function filterByCountryId($countryId = null, $comparison = null)
{
if (is_array($countryId)) {
$useMinMax = false;
if (isset($countryId['min'])) {
$this->addUsingAlias(AddressPeer::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($countryId['max'])) {
$this->addUsingAlias(AddressPeer::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AddressPeer::COUNTRY_ID, $countryId, $comparison);
}
/**
* Filter the query on the phone column
*
* Example usage:
* <code>
* $query->filterByPhone('fooValue'); // WHERE phone = 'fooValue'
* $query->filterByPhone('%fooValue%'); // WHERE phone LIKE '%fooValue%'
* </code>
*
* @param string $phone 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 AddressQuery The current query, for fluid interface
*/
public function filterByPhone($phone = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($phone)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $phone)) {
$phone = str_replace('*', '%', $phone);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AddressPeer::PHONE, $phone, $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 AddressQuery 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(AddressPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AddressPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AddressPeer::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 AddressQuery 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(AddressPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AddressPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AddressPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Customer object
*
* @param Customer|PropelObjectCollection $customer The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AddressQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCustomer($customer, $comparison = null)
{
if ($customer instanceof Customer) {
return $this
->addUsingAlias(AddressPeer::CUSTOMER_ID, $customer->getId(), $comparison);
} elseif ($customer instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AddressPeer::CUSTOMER_ID, $customer->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCustomer() only accepts arguments of type Customer or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Customer relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AddressQuery The current query, for fluid interface
*/
public function joinCustomer($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Customer');
// 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, 'Customer');
}
return $this;
}
/**
* Use the Customer relation Customer 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\CustomerQuery A secondary query class using the current class as primary query
*/
public function useCustomerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCustomer($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Customer', '\Thelia\Model\CustomerQuery');
}
/**
* Filter the query by a related CustomerTitle object
*
* @param CustomerTitle|PropelObjectCollection $customerTitle The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AddressQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCustomerTitle($customerTitle, $comparison = null)
{
if ($customerTitle instanceof CustomerTitle) {
return $this
->addUsingAlias(AddressPeer::CUSTOMER_TITLE_ID, $customerTitle->getId(), $comparison);
} elseif ($customerTitle instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AddressPeer::CUSTOMER_TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCustomerTitle() only accepts arguments of type CustomerTitle or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the CustomerTitle relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AddressQuery The current query, for fluid interface
*/
public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CustomerTitle');
// 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, 'CustomerTitle');
}
return $this;
}
/**
* Use the CustomerTitle relation CustomerTitle 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\CustomerTitleQuery A secondary query class using the current class as primary query
*/
public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCustomerTitle($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\Thelia\Model\CustomerTitleQuery');
}
/**
* Exclude object from result
*
* @param Address $address Object to remove from the list of results
*
* @return AddressQuery The current query, for fluid interface
*/
public function prune($address = null)
{
if ($address) {
$this->addUsingAlias(AddressPeer::ID, $address->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,609 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Admin;
use Thelia\Model\AdminGroup;
use Thelia\Model\AdminGroupPeer;
use Thelia\Model\AdminGroupQuery;
use Thelia\Model\Group;
/**
* Base class that represents a query for the 'admin_group' table.
*
*
*
* @method AdminGroupQuery orderById($order = Criteria::ASC) Order by the id column
* @method AdminGroupQuery orderByGroupId($order = Criteria::ASC) Order by the group_id column
* @method AdminGroupQuery orderByAdminId($order = Criteria::ASC) Order by the admin_id column
* @method AdminGroupQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AdminGroupQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AdminGroupQuery groupById() Group by the id column
* @method AdminGroupQuery groupByGroupId() Group by the group_id column
* @method AdminGroupQuery groupByAdminId() Group by the admin_id column
* @method AdminGroupQuery groupByCreatedAt() Group by the created_at column
* @method AdminGroupQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AdminGroupQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AdminGroupQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AdminGroupQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AdminGroupQuery leftJoinGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the Group relation
* @method AdminGroupQuery rightJoinGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Group relation
* @method AdminGroupQuery innerJoinGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the Group relation
*
* @method AdminGroupQuery leftJoinAdmin($relationAlias = null) Adds a LEFT JOIN clause to the query using the Admin relation
* @method AdminGroupQuery rightJoinAdmin($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Admin relation
* @method AdminGroupQuery innerJoinAdmin($relationAlias = null) Adds a INNER JOIN clause to the query using the Admin relation
*
* @method AdminGroup findOne(PropelPDO $con = null) Return the first AdminGroup matching the query
* @method AdminGroup findOneOrCreate(PropelPDO $con = null) Return the first AdminGroup matching the query, or a new AdminGroup object populated from the query conditions when no match is found
*
* @method AdminGroup findOneById(int $id) Return the first AdminGroup filtered by the id column
* @method AdminGroup findOneByGroupId(int $group_id) Return the first AdminGroup filtered by the group_id column
* @method AdminGroup findOneByAdminId(int $admin_id) Return the first AdminGroup filtered by the admin_id column
* @method AdminGroup findOneByCreatedAt(string $created_at) Return the first AdminGroup filtered by the created_at column
* @method AdminGroup findOneByUpdatedAt(string $updated_at) Return the first AdminGroup filtered by the updated_at column
*
* @method array findById(int $id) Return AdminGroup objects filtered by the id column
* @method array findByGroupId(int $group_id) Return AdminGroup objects filtered by the group_id column
* @method array findByAdminId(int $admin_id) Return AdminGroup objects filtered by the admin_id column
* @method array findByCreatedAt(string $created_at) Return AdminGroup objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return AdminGroup objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAdminGroupQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAdminGroupQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AdminGroup', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AdminGroupQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AdminGroupQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AdminGroupQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AdminGroupQuery) {
return $criteria;
}
$query = new AdminGroupQuery();
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 PropelPDO $con an optional connection object
*
* @return AdminGroup|AdminGroup[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AdminGroupPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AdminGroup A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `GROUP_ID`, `ADMIN_ID`, `CREATED_AT`, `UPDATED_AT` FROM `admin_group` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new AdminGroup();
$obj->hydrate($row);
AdminGroupPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AdminGroup|AdminGroup[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|AdminGroup[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AdminGroupQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AdminGroupPeer::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 AdminGroupQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AdminGroupPeer::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 AdminGroupQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AdminGroupPeer::ID, $id, $comparison);
}
/**
* Filter the query on the group_id column
*
* Example usage:
* <code>
* $query->filterByGroupId(1234); // WHERE group_id = 1234
* $query->filterByGroupId(array(12, 34)); // WHERE group_id IN (12, 34)
* $query->filterByGroupId(array('min' => 12)); // WHERE group_id > 12
* </code>
*
* @see filterByGroup()
*
* @param mixed $groupId 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 AdminGroupQuery The current query, for fluid interface
*/
public function filterByGroupId($groupId = null, $comparison = null)
{
if (is_array($groupId)) {
$useMinMax = false;
if (isset($groupId['min'])) {
$this->addUsingAlias(AdminGroupPeer::GROUP_ID, $groupId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($groupId['max'])) {
$this->addUsingAlias(AdminGroupPeer::GROUP_ID, $groupId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminGroupPeer::GROUP_ID, $groupId, $comparison);
}
/**
* Filter the query on the admin_id column
*
* Example usage:
* <code>
* $query->filterByAdminId(1234); // WHERE admin_id = 1234
* $query->filterByAdminId(array(12, 34)); // WHERE admin_id IN (12, 34)
* $query->filterByAdminId(array('min' => 12)); // WHERE admin_id > 12
* </code>
*
* @see filterByAdmin()
*
* @param mixed $adminId 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 AdminGroupQuery The current query, for fluid interface
*/
public function filterByAdminId($adminId = null, $comparison = null)
{
if (is_array($adminId)) {
$useMinMax = false;
if (isset($adminId['min'])) {
$this->addUsingAlias(AdminGroupPeer::ADMIN_ID, $adminId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($adminId['max'])) {
$this->addUsingAlias(AdminGroupPeer::ADMIN_ID, $adminId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminGroupPeer::ADMIN_ID, $adminId, $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 AdminGroupQuery 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(AdminGroupPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AdminGroupPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminGroupPeer::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 AdminGroupQuery 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(AdminGroupPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AdminGroupPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminGroupPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Group object
*
* @param Group|PropelObjectCollection $group The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AdminGroupQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByGroup($group, $comparison = null)
{
if ($group instanceof Group) {
return $this
->addUsingAlias(AdminGroupPeer::GROUP_ID, $group->getId(), $comparison);
} elseif ($group instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AdminGroupPeer::GROUP_ID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByGroup() only accepts arguments of type Group or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Group relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AdminGroupQuery The current query, for fluid interface
*/
public function joinGroup($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Group');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Group');
}
return $this;
}
/**
* Use the Group relation Group object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\GroupQuery A secondary query class using the current class as primary query
*/
public function useGroupQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinGroup($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Group', '\Thelia\Model\GroupQuery');
}
/**
* Filter the query by a related Admin object
*
* @param Admin|PropelObjectCollection $admin The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AdminGroupQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAdmin($admin, $comparison = null)
{
if ($admin instanceof Admin) {
return $this
->addUsingAlias(AdminGroupPeer::ADMIN_ID, $admin->getId(), $comparison);
} elseif ($admin instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AdminGroupPeer::ADMIN_ID, $admin->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAdmin() only accepts arguments of type Admin or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Admin relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AdminGroupQuery The current query, for fluid interface
*/
public function joinAdmin($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Admin');
// 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, 'Admin');
}
return $this;
}
/**
* Use the Admin relation Admin 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\AdminQuery A secondary query class using the current class as primary query
*/
public function useAdminQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinAdmin($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Admin', '\Thelia\Model\AdminQuery');
}
/**
* Exclude object from result
*
* @param AdminGroup $adminGroup Object to remove from the list of results
*
* @return AdminGroupQuery The current query, for fluid interface
*/
public function prune($adminGroup = null)
{
if ($adminGroup) {
$this->addUsingAlias(AdminGroupPeer::ID, $adminGroup->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,798 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\AdminLog;
use Thelia\Model\AdminLogPeer;
use Thelia\Model\map\AdminLogTableMap;
/**
* Base static class for performing query and update operations on the 'admin_log' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAdminLogPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'admin_log';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\AdminLog';
/** the related TableMap class for this table */
const TM_CLASS = 'AdminLogTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 8;
/** 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 = 8;
/** the column name for the ID field */
const ID = 'admin_log.ID';
/** the column name for the ADMIN_LOGIN field */
const ADMIN_LOGIN = 'admin_log.ADMIN_LOGIN';
/** the column name for the ADMIN_FIRSTNAME field */
const ADMIN_FIRSTNAME = 'admin_log.ADMIN_FIRSTNAME';
/** the column name for the ADMIN_LASTNAME field */
const ADMIN_LASTNAME = 'admin_log.ADMIN_LASTNAME';
/** the column name for the ACTION field */
const ACTION = 'admin_log.ACTION';
/** the column name for the REQUEST field */
const REQUEST = 'admin_log.REQUEST';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'admin_log.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'admin_log.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of AdminLog objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array AdminLog[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. AdminLogPeer::$fieldNames[AdminLogPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'AdminLogin', 'AdminFirstname', 'AdminLastname', 'Action', 'Request', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'adminLogin', 'adminFirstname', 'adminLastname', 'action', 'request', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (AdminLogPeer::ID, AdminLogPeer::ADMIN_LOGIN, AdminLogPeer::ADMIN_FIRSTNAME, AdminLogPeer::ADMIN_LASTNAME, AdminLogPeer::ACTION, AdminLogPeer::REQUEST, AdminLogPeer::CREATED_AT, AdminLogPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'ADMIN_LOGIN', 'ADMIN_FIRSTNAME', 'ADMIN_LASTNAME', 'ACTION', 'REQUEST', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'admin_login', 'admin_firstname', 'admin_lastname', 'action', 'request', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. AdminLogPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'AdminLogin' => 1, 'AdminFirstname' => 2, 'AdminLastname' => 3, 'Action' => 4, 'Request' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'adminLogin' => 1, 'adminFirstname' => 2, 'adminLastname' => 3, 'action' => 4, 'request' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
BasePeer::TYPE_COLNAME => array (AdminLogPeer::ID => 0, AdminLogPeer::ADMIN_LOGIN => 1, AdminLogPeer::ADMIN_FIRSTNAME => 2, AdminLogPeer::ADMIN_LASTNAME => 3, AdminLogPeer::ACTION => 4, AdminLogPeer::REQUEST => 5, AdminLogPeer::CREATED_AT => 6, AdminLogPeer::UPDATED_AT => 7, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'ADMIN_LOGIN' => 1, 'ADMIN_FIRSTNAME' => 2, 'ADMIN_LASTNAME' => 3, 'ACTION' => 4, 'REQUEST' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'admin_login' => 1, 'admin_firstname' => 2, 'admin_lastname' => 3, 'action' => 4, 'request' => 5, 'created_at' => 6, 'updated_at' => 7, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = AdminLogPeer::getFieldNames($toType);
$key = isset(AdminLogPeer::$fieldKeys[$fromType][$name]) ? AdminLogPeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AdminLogPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, AdminLogPeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return AdminLogPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. AdminLogPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(AdminLogPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(AdminLogPeer::ID);
$criteria->addSelectColumn(AdminLogPeer::ADMIN_LOGIN);
$criteria->addSelectColumn(AdminLogPeer::ADMIN_FIRSTNAME);
$criteria->addSelectColumn(AdminLogPeer::ADMIN_LASTNAME);
$criteria->addSelectColumn(AdminLogPeer::ACTION);
$criteria->addSelectColumn(AdminLogPeer::REQUEST);
$criteria->addSelectColumn(AdminLogPeer::CREATED_AT);
$criteria->addSelectColumn(AdminLogPeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.ADMIN_LOGIN');
$criteria->addSelectColumn($alias . '.ADMIN_FIRSTNAME');
$criteria->addSelectColumn($alias . '.ADMIN_LASTNAME');
$criteria->addSelectColumn($alias . '.ACTION');
$criteria->addSelectColumn($alias . '.REQUEST');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(AdminLogPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
AdminLogPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(AdminLogPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(AdminLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return AdminLog
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = AdminLogPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return AdminLogPeer::populateObjects(AdminLogPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
AdminLogPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(AdminLogPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param AdminLog $obj A AdminLog object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
AdminLogPeer::$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 AdminLog object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof AdminLog) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AdminLog object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(AdminLogPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return AdminLog Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(AdminLogPeer::$instances[$key])) {
return AdminLogPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
AdminLogPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to admin_log
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = AdminLogPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = AdminLogPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = AdminLogPeer::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;
AdminLogPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (AdminLog object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = AdminLogPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = AdminLogPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + AdminLogPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = AdminLogPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
AdminLogPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(AdminLogPeer::DATABASE_NAME)->getTable(AdminLogPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseAdminLogPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseAdminLogPeer::TABLE_NAME)) {
$dbMap->addTableObject(new AdminLogTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return AdminLogPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a AdminLog or Criteria object.
*
* @param mixed $values Criteria or AdminLog object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from AdminLog object
}
if ($criteria->containsKey(AdminLogPeer::ID) && $criteria->keyContainsValue(AdminLogPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.AdminLogPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(AdminLogPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a AdminLog or Criteria object.
*
* @param mixed $values Criteria or AdminLog object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(AdminLogPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(AdminLogPeer::ID);
$value = $criteria->remove(AdminLogPeer::ID);
if ($value) {
$selectCriteria->add(AdminLogPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(AdminLogPeer::TABLE_NAME);
}
} else { // $values is AdminLog object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(AdminLogPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the admin_log table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(AdminLogPeer::TABLE_NAME, $con, AdminLogPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
AdminLogPeer::clearInstancePool();
AdminLogPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a AdminLog or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or AdminLog object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
AdminLogPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof AdminLog) { // it's a model object
// invalidate the cache for this single object
AdminLogPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(AdminLogPeer::DATABASE_NAME);
$criteria->add(AdminLogPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
AdminLogPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(AdminLogPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
AdminLogPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given AdminLog object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param AdminLog $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(AdminLogPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(AdminLogPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(AdminLogPeer::DATABASE_NAME, AdminLogPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return AdminLog
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = AdminLogPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AdminLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(AdminLogPeer::DATABASE_NAME);
$criteria->add(AdminLogPeer::ID, $pk);
$v = AdminLogPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return AdminLog[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(AdminLogPeer::DATABASE_NAME);
$criteria->add(AdminLogPeer::ID, $pks, Criteria::IN);
$objs = AdminLogPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseAdminLogPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseAdminLogPeer::buildTableMap();

View File

@@ -0,0 +1,516 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \PDO;
use \Propel;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\AdminLog;
use Thelia\Model\AdminLogPeer;
use Thelia\Model\AdminLogQuery;
/**
* Base class that represents a query for the 'admin_log' table.
*
*
*
* @method AdminLogQuery orderById($order = Criteria::ASC) Order by the id column
* @method AdminLogQuery orderByAdminLogin($order = Criteria::ASC) Order by the admin_login column
* @method AdminLogQuery orderByAdminFirstname($order = Criteria::ASC) Order by the admin_firstname column
* @method AdminLogQuery orderByAdminLastname($order = Criteria::ASC) Order by the admin_lastname column
* @method AdminLogQuery orderByAction($order = Criteria::ASC) Order by the action column
* @method AdminLogQuery orderByRequest($order = Criteria::ASC) Order by the request column
* @method AdminLogQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AdminLogQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AdminLogQuery groupById() Group by the id column
* @method AdminLogQuery groupByAdminLogin() Group by the admin_login column
* @method AdminLogQuery groupByAdminFirstname() Group by the admin_firstname column
* @method AdminLogQuery groupByAdminLastname() Group by the admin_lastname column
* @method AdminLogQuery groupByAction() Group by the action column
* @method AdminLogQuery groupByRequest() Group by the request column
* @method AdminLogQuery groupByCreatedAt() Group by the created_at column
* @method AdminLogQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AdminLogQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AdminLogQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AdminLogQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AdminLog findOne(PropelPDO $con = null) Return the first AdminLog matching the query
* @method AdminLog findOneOrCreate(PropelPDO $con = null) Return the first AdminLog matching the query, or a new AdminLog object populated from the query conditions when no match is found
*
* @method AdminLog findOneById(int $id) Return the first AdminLog filtered by the id column
* @method AdminLog findOneByAdminLogin(string $admin_login) Return the first AdminLog filtered by the admin_login column
* @method AdminLog findOneByAdminFirstname(string $admin_firstname) Return the first AdminLog filtered by the admin_firstname column
* @method AdminLog findOneByAdminLastname(string $admin_lastname) Return the first AdminLog filtered by the admin_lastname column
* @method AdminLog findOneByAction(string $action) Return the first AdminLog filtered by the action column
* @method AdminLog findOneByRequest(string $request) Return the first AdminLog filtered by the request column
* @method AdminLog findOneByCreatedAt(string $created_at) Return the first AdminLog filtered by the created_at column
* @method AdminLog findOneByUpdatedAt(string $updated_at) Return the first AdminLog filtered by the updated_at column
*
* @method array findById(int $id) Return AdminLog objects filtered by the id column
* @method array findByAdminLogin(string $admin_login) Return AdminLog objects filtered by the admin_login column
* @method array findByAdminFirstname(string $admin_firstname) Return AdminLog objects filtered by the admin_firstname column
* @method array findByAdminLastname(string $admin_lastname) Return AdminLog objects filtered by the admin_lastname column
* @method array findByAction(string $action) Return AdminLog objects filtered by the action column
* @method array findByRequest(string $request) Return AdminLog objects filtered by the request column
* @method array findByCreatedAt(string $created_at) Return AdminLog objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return AdminLog objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAdminLogQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAdminLogQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AdminLog', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AdminLogQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AdminLogQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AdminLogQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AdminLogQuery) {
return $criteria;
}
$query = new AdminLogQuery();
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 PropelPDO $con an optional connection object
*
* @return AdminLog|AdminLog[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AdminLogPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AdminLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AdminLog A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `ADMIN_LOGIN`, `ADMIN_FIRSTNAME`, `ADMIN_LASTNAME`, `ACTION`, `REQUEST`, `CREATED_AT`, `UPDATED_AT` FROM `admin_log` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new AdminLog();
$obj->hydrate($row);
AdminLogPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AdminLog|AdminLog[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|AdminLog[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AdminLogQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AdminLogPeer::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 AdminLogQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AdminLogPeer::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 AdminLogQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AdminLogPeer::ID, $id, $comparison);
}
/**
* Filter the query on the admin_login column
*
* Example usage:
* <code>
* $query->filterByAdminLogin('fooValue'); // WHERE admin_login = 'fooValue'
* $query->filterByAdminLogin('%fooValue%'); // WHERE admin_login LIKE '%fooValue%'
* </code>
*
* @param string $adminLogin 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 AdminLogQuery The current query, for fluid interface
*/
public function filterByAdminLogin($adminLogin = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($adminLogin)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $adminLogin)) {
$adminLogin = str_replace('*', '%', $adminLogin);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminLogPeer::ADMIN_LOGIN, $adminLogin, $comparison);
}
/**
* Filter the query on the admin_firstname column
*
* Example usage:
* <code>
* $query->filterByAdminFirstname('fooValue'); // WHERE admin_firstname = 'fooValue'
* $query->filterByAdminFirstname('%fooValue%'); // WHERE admin_firstname LIKE '%fooValue%'
* </code>
*
* @param string $adminFirstname 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 AdminLogQuery The current query, for fluid interface
*/
public function filterByAdminFirstname($adminFirstname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($adminFirstname)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $adminFirstname)) {
$adminFirstname = str_replace('*', '%', $adminFirstname);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminLogPeer::ADMIN_FIRSTNAME, $adminFirstname, $comparison);
}
/**
* Filter the query on the admin_lastname column
*
* Example usage:
* <code>
* $query->filterByAdminLastname('fooValue'); // WHERE admin_lastname = 'fooValue'
* $query->filterByAdminLastname('%fooValue%'); // WHERE admin_lastname LIKE '%fooValue%'
* </code>
*
* @param string $adminLastname 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 AdminLogQuery The current query, for fluid interface
*/
public function filterByAdminLastname($adminLastname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($adminLastname)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $adminLastname)) {
$adminLastname = str_replace('*', '%', $adminLastname);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminLogPeer::ADMIN_LASTNAME, $adminLastname, $comparison);
}
/**
* Filter the query on the action column
*
* Example usage:
* <code>
* $query->filterByAction('fooValue'); // WHERE action = 'fooValue'
* $query->filterByAction('%fooValue%'); // WHERE action LIKE '%fooValue%'
* </code>
*
* @param string $action 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 AdminLogQuery The current query, for fluid interface
*/
public function filterByAction($action = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($action)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $action)) {
$action = str_replace('*', '%', $action);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminLogPeer::ACTION, $action, $comparison);
}
/**
* Filter the query on the request column
*
* Example usage:
* <code>
* $query->filterByRequest('fooValue'); // WHERE request = 'fooValue'
* $query->filterByRequest('%fooValue%'); // WHERE request LIKE '%fooValue%'
* </code>
*
* @param string $request 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 AdminLogQuery The current query, for fluid interface
*/
public function filterByRequest($request = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($request)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $request)) {
$request = str_replace('*', '%', $request);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminLogPeer::REQUEST, $request, $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 AdminLogQuery 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(AdminLogPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AdminLogPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminLogPeer::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 AdminLogQuery 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(AdminLogPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AdminLogPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminLogPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Exclude object from result
*
* @param AdminLog $adminLog Object to remove from the list of results
*
* @return AdminLogQuery The current query, for fluid interface
*/
public function prune($adminLog = null)
{
if ($adminLog) {
$this->addUsingAlias(AdminLogPeer::ID, $adminLog->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

View File

@@ -0,0 +1,807 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\Admin;
use Thelia\Model\AdminGroupPeer;
use Thelia\Model\AdminPeer;
use Thelia\Model\map\AdminTableMap;
/**
* Base static class for performing query and update operations on the 'admin' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAdminPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'admin';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\Admin';
/** the related TableMap class for this table */
const TM_CLASS = 'AdminTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 9;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 9;
/** the column name for the ID field */
const ID = 'admin.ID';
/** the column name for the FIRSTNAME field */
const FIRSTNAME = 'admin.FIRSTNAME';
/** the column name for the LASTNAME field */
const LASTNAME = 'admin.LASTNAME';
/** the column name for the LOGIN field */
const LOGIN = 'admin.LOGIN';
/** the column name for the PASSWORD field */
const PASSWORD = 'admin.PASSWORD';
/** the column name for the ALGO field */
const ALGO = 'admin.ALGO';
/** the column name for the SALT field */
const SALT = 'admin.SALT';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'admin.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'admin.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of Admin objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array Admin[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. AdminPeer::$fieldNames[AdminPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (AdminPeer::ID, AdminPeer::FIRSTNAME, AdminPeer::LASTNAME, AdminPeer::LOGIN, AdminPeer::PASSWORD, AdminPeer::ALGO, AdminPeer::SALT, AdminPeer::CREATED_AT, AdminPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. AdminPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Firstname' => 1, 'Lastname' => 2, 'Login' => 3, 'Password' => 4, 'Algo' => 5, 'Salt' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
BasePeer::TYPE_COLNAME => array (AdminPeer::ID => 0, AdminPeer::FIRSTNAME => 1, AdminPeer::LASTNAME => 2, AdminPeer::LOGIN => 3, AdminPeer::PASSWORD => 4, AdminPeer::ALGO => 5, AdminPeer::SALT => 6, AdminPeer::CREATED_AT => 7, AdminPeer::UPDATED_AT => 8, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FIRSTNAME' => 1, 'LASTNAME' => 2, 'LOGIN' => 3, 'PASSWORD' => 4, 'ALGO' => 5, 'SALT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'created_at' => 7, 'updated_at' => 8, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = AdminPeer::getFieldNames($toType);
$key = isset(AdminPeer::$fieldKeys[$fromType][$name]) ? AdminPeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AdminPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, AdminPeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return AdminPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. AdminPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(AdminPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(AdminPeer::ID);
$criteria->addSelectColumn(AdminPeer::FIRSTNAME);
$criteria->addSelectColumn(AdminPeer::LASTNAME);
$criteria->addSelectColumn(AdminPeer::LOGIN);
$criteria->addSelectColumn(AdminPeer::PASSWORD);
$criteria->addSelectColumn(AdminPeer::ALGO);
$criteria->addSelectColumn(AdminPeer::SALT);
$criteria->addSelectColumn(AdminPeer::CREATED_AT);
$criteria->addSelectColumn(AdminPeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.FIRSTNAME');
$criteria->addSelectColumn($alias . '.LASTNAME');
$criteria->addSelectColumn($alias . '.LOGIN');
$criteria->addSelectColumn($alias . '.PASSWORD');
$criteria->addSelectColumn($alias . '.ALGO');
$criteria->addSelectColumn($alias . '.SALT');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(AdminPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
AdminPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(AdminPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return Admin
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = AdminPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return AdminPeer::populateObjects(AdminPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
AdminPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(AdminPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Admin $obj A Admin object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
AdminPeer::$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 Admin object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof Admin) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Admin object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(AdminPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return Admin Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(AdminPeer::$instances[$key])) {
return AdminPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
AdminPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to admin
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in AdminGroupPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AdminGroupPeer::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = AdminPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = AdminPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = AdminPeer::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;
AdminPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (Admin object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = AdminPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = AdminPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + AdminPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = AdminPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
AdminPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(AdminPeer::DATABASE_NAME)->getTable(AdminPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseAdminPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseAdminPeer::TABLE_NAME)) {
$dbMap->addTableObject(new AdminTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return AdminPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a Admin or Criteria object.
*
* @param mixed $values Criteria or Admin object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Admin object
}
if ($criteria->containsKey(AdminPeer::ID) && $criteria->keyContainsValue(AdminPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.AdminPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(AdminPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a Admin or Criteria object.
*
* @param mixed $values Criteria or Admin object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(AdminPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(AdminPeer::ID);
$value = $criteria->remove(AdminPeer::ID);
if ($value) {
$selectCriteria->add(AdminPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(AdminPeer::TABLE_NAME);
}
} else { // $values is Admin object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(AdminPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the admin table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(AdminPeer::TABLE_NAME, $con, AdminPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
AdminPeer::clearInstancePool();
AdminPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a Admin or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Admin object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
AdminPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof Admin) { // it's a model object
// invalidate the cache for this single object
AdminPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(AdminPeer::DATABASE_NAME);
$criteria->add(AdminPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
AdminPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(AdminPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
AdminPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given Admin object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param Admin $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(AdminPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(AdminPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(AdminPeer::DATABASE_NAME, AdminPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return Admin
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = AdminPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(AdminPeer::DATABASE_NAME);
$criteria->add(AdminPeer::ID, $pk);
$v = AdminPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return Admin[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(AdminPeer::DATABASE_NAME);
$criteria->add(AdminPeer::ID, $pks, Criteria::IN);
$objs = AdminPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseAdminPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseAdminPeer::buildTableMap();

View File

@@ -0,0 +1,630 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Admin;
use Thelia\Model\AdminGroup;
use Thelia\Model\AdminPeer;
use Thelia\Model\AdminQuery;
/**
* Base class that represents a query for the 'admin' table.
*
*
*
* @method AdminQuery orderById($order = Criteria::ASC) Order by the id column
* @method AdminQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
* @method AdminQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
* @method AdminQuery orderByLogin($order = Criteria::ASC) Order by the login column
* @method AdminQuery orderByPassword($order = Criteria::ASC) Order by the password column
* @method AdminQuery orderByAlgo($order = Criteria::ASC) Order by the algo column
* @method AdminQuery orderBySalt($order = Criteria::ASC) Order by the salt column
* @method AdminQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AdminQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AdminQuery groupById() Group by the id column
* @method AdminQuery groupByFirstname() Group by the firstname column
* @method AdminQuery groupByLastname() Group by the lastname column
* @method AdminQuery groupByLogin() Group by the login column
* @method AdminQuery groupByPassword() Group by the password column
* @method AdminQuery groupByAlgo() Group by the algo column
* @method AdminQuery groupBySalt() Group by the salt column
* @method AdminQuery groupByCreatedAt() Group by the created_at column
* @method AdminQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AdminQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AdminQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AdminQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AdminQuery leftJoinAdminGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the AdminGroup relation
* @method AdminQuery rightJoinAdminGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AdminGroup relation
* @method AdminQuery innerJoinAdminGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the AdminGroup relation
*
* @method Admin findOne(PropelPDO $con = null) Return the first Admin matching the query
* @method Admin findOneOrCreate(PropelPDO $con = null) Return the first Admin matching the query, or a new Admin object populated from the query conditions when no match is found
*
* @method Admin findOneById(int $id) Return the first Admin filtered by the id column
* @method Admin findOneByFirstname(string $firstname) Return the first Admin filtered by the firstname column
* @method Admin findOneByLastname(string $lastname) Return the first Admin filtered by the lastname column
* @method Admin findOneByLogin(string $login) Return the first Admin filtered by the login column
* @method Admin findOneByPassword(string $password) Return the first Admin filtered by the password column
* @method Admin findOneByAlgo(string $algo) Return the first Admin filtered by the algo column
* @method Admin findOneBySalt(string $salt) Return the first Admin filtered by the salt column
* @method Admin findOneByCreatedAt(string $created_at) Return the first Admin filtered by the created_at column
* @method Admin findOneByUpdatedAt(string $updated_at) Return the first Admin filtered by the updated_at column
*
* @method array findById(int $id) Return Admin objects filtered by the id column
* @method array findByFirstname(string $firstname) Return Admin objects filtered by the firstname column
* @method array findByLastname(string $lastname) Return Admin objects filtered by the lastname column
* @method array findByLogin(string $login) Return Admin objects filtered by the login column
* @method array findByPassword(string $password) Return Admin objects filtered by the password column
* @method array findByAlgo(string $algo) Return Admin objects filtered by the algo column
* @method array findBySalt(string $salt) Return Admin objects filtered by the salt column
* @method array findByCreatedAt(string $created_at) Return Admin objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Admin objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAdminQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAdminQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Admin', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AdminQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AdminQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AdminQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AdminQuery) {
return $criteria;
}
$query = new AdminQuery();
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 PropelPDO $con an optional connection object
*
* @return Admin|Admin[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AdminPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Admin A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `FIRSTNAME`, `LASTNAME`, `LOGIN`, `PASSWORD`, `ALGO`, `SALT`, `CREATED_AT`, `UPDATED_AT` FROM `admin` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Admin();
$obj->hydrate($row);
AdminPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Admin|Admin[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Admin[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AdminQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AdminPeer::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 AdminQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AdminPeer::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 AdminQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AdminPeer::ID, $id, $comparison);
}
/**
* Filter the query on the firstname column
*
* Example usage:
* <code>
* $query->filterByFirstname('fooValue'); // WHERE firstname = 'fooValue'
* $query->filterByFirstname('%fooValue%'); // WHERE firstname LIKE '%fooValue%'
* </code>
*
* @param string $firstname 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 AdminQuery The current query, for fluid interface
*/
public function filterByFirstname($firstname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($firstname)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $firstname)) {
$firstname = str_replace('*', '%', $firstname);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminPeer::FIRSTNAME, $firstname, $comparison);
}
/**
* Filter the query on the lastname column
*
* Example usage:
* <code>
* $query->filterByLastname('fooValue'); // WHERE lastname = 'fooValue'
* $query->filterByLastname('%fooValue%'); // WHERE lastname LIKE '%fooValue%'
* </code>
*
* @param string $lastname 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 AdminQuery The current query, for fluid interface
*/
public function filterByLastname($lastname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lastname)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lastname)) {
$lastname = str_replace('*', '%', $lastname);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminPeer::LASTNAME, $lastname, $comparison);
}
/**
* Filter the query on the login column
*
* Example usage:
* <code>
* $query->filterByLogin('fooValue'); // WHERE login = 'fooValue'
* $query->filterByLogin('%fooValue%'); // WHERE login LIKE '%fooValue%'
* </code>
*
* @param string $login 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 AdminQuery The current query, for fluid interface
*/
public function filterByLogin($login = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($login)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $login)) {
$login = str_replace('*', '%', $login);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminPeer::LOGIN, $login, $comparison);
}
/**
* Filter the query on the password column
*
* Example usage:
* <code>
* $query->filterByPassword('fooValue'); // WHERE password = 'fooValue'
* $query->filterByPassword('%fooValue%'); // WHERE password LIKE '%fooValue%'
* </code>
*
* @param string $password 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 AdminQuery The current query, for fluid interface
*/
public function filterByPassword($password = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($password)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $password)) {
$password = str_replace('*', '%', $password);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminPeer::PASSWORD, $password, $comparison);
}
/**
* Filter the query on the algo column
*
* Example usage:
* <code>
* $query->filterByAlgo('fooValue'); // WHERE algo = 'fooValue'
* $query->filterByAlgo('%fooValue%'); // WHERE algo LIKE '%fooValue%'
* </code>
*
* @param string $algo 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 AdminQuery The current query, for fluid interface
*/
public function filterByAlgo($algo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($algo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $algo)) {
$algo = str_replace('*', '%', $algo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminPeer::ALGO, $algo, $comparison);
}
/**
* Filter the query on the salt column
*
* Example usage:
* <code>
* $query->filterBySalt('fooValue'); // WHERE salt = 'fooValue'
* $query->filterBySalt('%fooValue%'); // WHERE salt LIKE '%fooValue%'
* </code>
*
* @param string $salt 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 AdminQuery The current query, for fluid interface
*/
public function filterBySalt($salt = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($salt)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $salt)) {
$salt = str_replace('*', '%', $salt);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminPeer::SALT, $salt, $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 AdminQuery 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(AdminPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AdminPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminPeer::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 AdminQuery 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(AdminPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AdminPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AdminPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related AdminGroup object
*
* @param AdminGroup|PropelObjectCollection $adminGroup the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AdminQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAdminGroup($adminGroup, $comparison = null)
{
if ($adminGroup instanceof AdminGroup) {
return $this
->addUsingAlias(AdminPeer::ID, $adminGroup->getAdminId(), $comparison);
} elseif ($adminGroup instanceof PropelObjectCollection) {
return $this
->useAdminGroupQuery()
->filterByPrimaryKeys($adminGroup->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAdminGroup() only accepts arguments of type AdminGroup or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the AdminGroup relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AdminQuery The current query, for fluid interface
*/
public function joinAdminGroup($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AdminGroup');
// 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, 'AdminGroup');
}
return $this;
}
/**
* Use the AdminGroup relation AdminGroup 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\AdminGroupQuery A secondary query class using the current class as primary query
*/
public function useAdminGroupQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinAdminGroup($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AdminGroup', '\Thelia\Model\AdminGroupQuery');
}
/**
* Exclude object from result
*
* @param Admin $admin Object to remove from the list of results
*
* @return AdminQuery The current query, for fluid interface
*/
public function prune($admin = null)
{
if ($admin) {
$this->addUsingAlias(AdminPeer::ID, $admin->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,791 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\Area;
use Thelia\Model\AreaPeer;
use Thelia\Model\CountryPeer;
use Thelia\Model\DelivzonePeer;
use Thelia\Model\map\AreaTableMap;
/**
* Base static class for performing query and update operations on the 'area' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAreaPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'area';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\Area';
/** the related TableMap class for this table */
const TM_CLASS = 'AreaTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 5;
/** 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 = 5;
/** the column name for the ID field */
const ID = 'area.ID';
/** the column name for the NAME field */
const NAME = 'area.NAME';
/** the column name for the UNIT field */
const UNIT = 'area.UNIT';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'area.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'area.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of Area objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array Area[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. AreaPeer::$fieldNames[AreaPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Name', 'Unit', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'unit', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (AreaPeer::ID, AreaPeer::NAME, AreaPeer::UNIT, AreaPeer::CREATED_AT, AreaPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'UNIT', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'unit', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. AreaPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'Unit' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'unit' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
BasePeer::TYPE_COLNAME => array (AreaPeer::ID => 0, AreaPeer::NAME => 1, AreaPeer::UNIT => 2, AreaPeer::CREATED_AT => 3, AreaPeer::UPDATED_AT => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'UNIT' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'unit' => 2, 'created_at' => 3, 'updated_at' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = AreaPeer::getFieldNames($toType);
$key = isset(AreaPeer::$fieldKeys[$fromType][$name]) ? AreaPeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AreaPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, AreaPeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return AreaPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. AreaPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(AreaPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(AreaPeer::ID);
$criteria->addSelectColumn(AreaPeer::NAME);
$criteria->addSelectColumn(AreaPeer::UNIT);
$criteria->addSelectColumn(AreaPeer::CREATED_AT);
$criteria->addSelectColumn(AreaPeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.UNIT');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(AreaPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
AreaPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(AreaPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return Area
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = AreaPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return AreaPeer::populateObjects(AreaPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
AreaPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(AreaPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Area $obj A Area object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
AreaPeer::$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 Area object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof Area) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Area object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(AreaPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return Area Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(AreaPeer::$instances[$key])) {
return AreaPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
AreaPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to area
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in CountryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CountryPeer::clearInstancePool();
// Invalidate objects in DelivzonePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
DelivzonePeer::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = AreaPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = AreaPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = AreaPeer::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;
AreaPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (Area object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = AreaPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = AreaPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + AreaPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = AreaPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
AreaPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(AreaPeer::DATABASE_NAME)->getTable(AreaPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseAreaPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseAreaPeer::TABLE_NAME)) {
$dbMap->addTableObject(new AreaTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return AreaPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a Area or Criteria object.
*
* @param mixed $values Criteria or Area object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Area object
}
if ($criteria->containsKey(AreaPeer::ID) && $criteria->keyContainsValue(AreaPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.AreaPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(AreaPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a Area or Criteria object.
*
* @param mixed $values Criteria or Area object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(AreaPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(AreaPeer::ID);
$value = $criteria->remove(AreaPeer::ID);
if ($value) {
$selectCriteria->add(AreaPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(AreaPeer::TABLE_NAME);
}
} else { // $values is Area object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(AreaPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the area table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(AreaPeer::TABLE_NAME, $con, AreaPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
AreaPeer::clearInstancePool();
AreaPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a Area or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Area object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
AreaPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof Area) { // it's a model object
// invalidate the cache for this single object
AreaPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(AreaPeer::DATABASE_NAME);
$criteria->add(AreaPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
AreaPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(AreaPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
AreaPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given Area object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param Area $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(AreaPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(AreaPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(AreaPeer::DATABASE_NAME, AreaPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return Area
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = AreaPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(AreaPeer::DATABASE_NAME);
$criteria->add(AreaPeer::ID, $pk);
$v = AreaPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return Area[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(AreaPeer::DATABASE_NAME);
$criteria->add(AreaPeer::ID, $pks, Criteria::IN);
$objs = AreaPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseAreaPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseAreaPeer::buildTableMap();

View File

@@ -0,0 +1,589 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Area;
use Thelia\Model\AreaPeer;
use Thelia\Model\AreaQuery;
use Thelia\Model\Country;
use Thelia\Model\Delivzone;
/**
* Base class that represents a query for the 'area' table.
*
*
*
* @method AreaQuery orderById($order = Criteria::ASC) Order by the id column
* @method AreaQuery orderByName($order = Criteria::ASC) Order by the name column
* @method AreaQuery orderByUnit($order = Criteria::ASC) Order by the unit column
* @method AreaQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AreaQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AreaQuery groupById() Group by the id column
* @method AreaQuery groupByName() Group by the name column
* @method AreaQuery groupByUnit() Group by the unit column
* @method AreaQuery groupByCreatedAt() Group by the created_at column
* @method AreaQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AreaQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AreaQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AreaQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AreaQuery leftJoinCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the Country relation
* @method AreaQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
* @method AreaQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
*
* @method AreaQuery leftJoinDelivzone($relationAlias = null) Adds a LEFT JOIN clause to the query using the Delivzone relation
* @method AreaQuery rightJoinDelivzone($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Delivzone relation
* @method AreaQuery innerJoinDelivzone($relationAlias = null) Adds a INNER JOIN clause to the query using the Delivzone relation
*
* @method Area findOne(PropelPDO $con = null) Return the first Area matching the query
* @method Area findOneOrCreate(PropelPDO $con = null) Return the first Area matching the query, or a new Area object populated from the query conditions when no match is found
*
* @method Area findOneById(int $id) Return the first Area filtered by the id column
* @method Area findOneByName(string $name) Return the first Area filtered by the name column
* @method Area findOneByUnit(double $unit) Return the first Area filtered by the unit column
* @method Area findOneByCreatedAt(string $created_at) Return the first Area filtered by the created_at column
* @method Area findOneByUpdatedAt(string $updated_at) Return the first Area filtered by the updated_at column
*
* @method array findById(int $id) Return Area objects filtered by the id column
* @method array findByName(string $name) Return Area objects filtered by the name column
* @method array findByUnit(double $unit) Return Area objects filtered by the unit column
* @method array findByCreatedAt(string $created_at) Return Area objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Area objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAreaQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAreaQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Area', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AreaQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AreaQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AreaQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AreaQuery) {
return $criteria;
}
$query = new AreaQuery();
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 PropelPDO $con an optional connection object
*
* @return Area|Area[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AreaPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Area A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `NAME`, `UNIT`, `CREATED_AT`, `UPDATED_AT` FROM `area` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Area();
$obj->hydrate($row);
AreaPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Area|Area[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Area[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AreaQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AreaPeer::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 AreaQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AreaPeer::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 AreaQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AreaPeer::ID, $id, $comparison);
}
/**
* Filter the query on the name column
*
* Example usage:
* <code>
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
* </code>
*
* @param string $name The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AreaQuery The current query, for fluid interface
*/
public function filterByName($name = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($name)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $name)) {
$name = str_replace('*', '%', $name);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AreaPeer::NAME, $name, $comparison);
}
/**
* Filter the query on the unit column
*
* Example usage:
* <code>
* $query->filterByUnit(1234); // WHERE unit = 1234
* $query->filterByUnit(array(12, 34)); // WHERE unit IN (12, 34)
* $query->filterByUnit(array('min' => 12)); // WHERE unit > 12
* </code>
*
* @param mixed $unit 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 AreaQuery The current query, for fluid interface
*/
public function filterByUnit($unit = null, $comparison = null)
{
if (is_array($unit)) {
$useMinMax = false;
if (isset($unit['min'])) {
$this->addUsingAlias(AreaPeer::UNIT, $unit['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($unit['max'])) {
$this->addUsingAlias(AreaPeer::UNIT, $unit['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AreaPeer::UNIT, $unit, $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 AreaQuery 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(AreaPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AreaPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AreaPeer::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 AreaQuery 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(AreaPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AreaPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AreaPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Country object
*
* @param Country|PropelObjectCollection $country the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AreaQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCountry($country, $comparison = null)
{
if ($country instanceof Country) {
return $this
->addUsingAlias(AreaPeer::ID, $country->getAreaId(), $comparison);
} elseif ($country instanceof PropelObjectCollection) {
return $this
->useCountryQuery()
->filterByPrimaryKeys($country->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCountry() only accepts arguments of type Country or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Country relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AreaQuery The current query, for fluid interface
*/
public function joinCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Country');
// 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, 'Country');
}
return $this;
}
/**
* Use the Country relation Country 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\CountryQuery A secondary query class using the current class as primary query
*/
public function useCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCountry($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Country', '\Thelia\Model\CountryQuery');
}
/**
* Filter the query by a related Delivzone object
*
* @param Delivzone|PropelObjectCollection $delivzone the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AreaQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByDelivzone($delivzone, $comparison = null)
{
if ($delivzone instanceof Delivzone) {
return $this
->addUsingAlias(AreaPeer::ID, $delivzone->getAreaId(), $comparison);
} elseif ($delivzone instanceof PropelObjectCollection) {
return $this
->useDelivzoneQuery()
->filterByPrimaryKeys($delivzone->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByDelivzone() only accepts arguments of type Delivzone or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Delivzone relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AreaQuery The current query, for fluid interface
*/
public function joinDelivzone($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Delivzone');
// 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, 'Delivzone');
}
return $this;
}
/**
* Use the Delivzone relation Delivzone 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\DelivzoneQuery A secondary query class using the current class as primary query
*/
public function useDelivzoneQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinDelivzone($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Delivzone', '\Thelia\Model\DelivzoneQuery');
}
/**
* Exclude object from result
*
* @param Area $area Object to remove from the list of results
*
* @return AreaQuery The current query, for fluid interface
*/
public function prune($area = null)
{
if ($area) {
$this->addUsingAlias(AreaPeer::ID, $area->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,613 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\AttributeAv;
use Thelia\Model\AttributeAvDesc;
use Thelia\Model\AttributeAvDescPeer;
use Thelia\Model\AttributeAvDescQuery;
/**
* Base class that represents a query for the 'attribute_av_desc' table.
*
*
*
* @method AttributeAvDescQuery orderById($order = Criteria::ASC) Order by the id column
* @method AttributeAvDescQuery orderByAttributeAvId($order = Criteria::ASC) Order by the attribute_av_id column
* @method AttributeAvDescQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method AttributeAvDescQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method AttributeAvDescQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method AttributeAvDescQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method AttributeAvDescQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AttributeAvDescQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AttributeAvDescQuery groupById() Group by the id column
* @method AttributeAvDescQuery groupByAttributeAvId() Group by the attribute_av_id column
* @method AttributeAvDescQuery groupByLang() Group by the lang column
* @method AttributeAvDescQuery groupByTitle() Group by the title column
* @method AttributeAvDescQuery groupByDescription() Group by the description column
* @method AttributeAvDescQuery groupByChapo() Group by the chapo column
* @method AttributeAvDescQuery groupByCreatedAt() Group by the created_at column
* @method AttributeAvDescQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AttributeAvDescQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AttributeAvDescQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AttributeAvDescQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AttributeAvDescQuery leftJoinAttributeAv($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeAv relation
* @method AttributeAvDescQuery rightJoinAttributeAv($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeAv relation
* @method AttributeAvDescQuery innerJoinAttributeAv($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeAv relation
*
* @method AttributeAvDesc findOne(PropelPDO $con = null) Return the first AttributeAvDesc matching the query
* @method AttributeAvDesc findOneOrCreate(PropelPDO $con = null) Return the first AttributeAvDesc matching the query, or a new AttributeAvDesc object populated from the query conditions when no match is found
*
* @method AttributeAvDesc findOneById(int $id) Return the first AttributeAvDesc filtered by the id column
* @method AttributeAvDesc findOneByAttributeAvId(int $attribute_av_id) Return the first AttributeAvDesc filtered by the attribute_av_id column
* @method AttributeAvDesc findOneByLang(string $lang) Return the first AttributeAvDesc filtered by the lang column
* @method AttributeAvDesc findOneByTitle(string $title) Return the first AttributeAvDesc filtered by the title column
* @method AttributeAvDesc findOneByDescription(string $description) Return the first AttributeAvDesc filtered by the description column
* @method AttributeAvDesc findOneByChapo(string $chapo) Return the first AttributeAvDesc filtered by the chapo column
* @method AttributeAvDesc findOneByCreatedAt(string $created_at) Return the first AttributeAvDesc filtered by the created_at column
* @method AttributeAvDesc findOneByUpdatedAt(string $updated_at) Return the first AttributeAvDesc filtered by the updated_at column
*
* @method array findById(int $id) Return AttributeAvDesc objects filtered by the id column
* @method array findByAttributeAvId(int $attribute_av_id) Return AttributeAvDesc objects filtered by the attribute_av_id column
* @method array findByLang(string $lang) Return AttributeAvDesc objects filtered by the lang column
* @method array findByTitle(string $title) Return AttributeAvDesc objects filtered by the title column
* @method array findByDescription(string $description) Return AttributeAvDesc objects filtered by the description column
* @method array findByChapo(string $chapo) Return AttributeAvDesc objects filtered by the chapo column
* @method array findByCreatedAt(string $created_at) Return AttributeAvDesc objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return AttributeAvDesc objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAttributeAvDescQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAttributeAvDescQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AttributeAvDesc', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AttributeAvDescQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AttributeAvDescQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AttributeAvDescQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AttributeAvDescQuery) {
return $criteria;
}
$query = new AttributeAvDescQuery();
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 PropelPDO $con an optional connection object
*
* @return AttributeAvDesc|AttributeAvDesc[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AttributeAvDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AttributeAvDesc A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `ATTRIBUTE_AV_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_av_desc` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new AttributeAvDesc();
$obj->hydrate($row);
AttributeAvDescPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AttributeAvDesc|AttributeAvDesc[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|AttributeAvDesc[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AttributeAvDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AttributeAvDescPeer::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 AttributeAvDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AttributeAvDescPeer::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 AttributeAvDescQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AttributeAvDescPeer::ID, $id, $comparison);
}
/**
* Filter the query on the attribute_av_id column
*
* Example usage:
* <code>
* $query->filterByAttributeAvId(1234); // WHERE attribute_av_id = 1234
* $query->filterByAttributeAvId(array(12, 34)); // WHERE attribute_av_id IN (12, 34)
* $query->filterByAttributeAvId(array('min' => 12)); // WHERE attribute_av_id > 12
* </code>
*
* @see filterByAttributeAv()
*
* @param mixed $attributeAvId 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 AttributeAvDescQuery The current query, for fluid interface
*/
public function filterByAttributeAvId($attributeAvId = null, $comparison = null)
{
if (is_array($attributeAvId)) {
$useMinMax = false;
if (isset($attributeAvId['min'])) {
$this->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAvId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($attributeAvId['max'])) {
$this->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAvId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAvId, $comparison);
}
/**
* Filter the query on the lang column
*
* Example usage:
* <code>
* $query->filterByLang('fooValue'); // WHERE lang = 'fooValue'
* $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
* </code>
*
* @param string $lang 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 AttributeAvDescQuery The current query, for fluid interface
*/
public function filterByLang($lang = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lang)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lang)) {
$lang = str_replace('*', '%', $lang);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AttributeAvDescPeer::LANG, $lang, $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 AttributeAvDescQuery 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(AttributeAvDescPeer::TITLE, $title, $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 AttributeAvDescQuery 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(AttributeAvDescPeer::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo 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 AttributeAvDescQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AttributeAvDescPeer::CHAPO, $chapo, $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 AttributeAvDescQuery 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(AttributeAvDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AttributeAvDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeAvDescPeer::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 AttributeAvDescQuery 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(AttributeAvDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AttributeAvDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeAvDescPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related AttributeAv object
*
* @param AttributeAv|PropelObjectCollection $attributeAv The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeAvDescQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttributeAv($attributeAv, $comparison = null)
{
if ($attributeAv instanceof AttributeAv) {
return $this
->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAv->getId(), $comparison);
} elseif ($attributeAv instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAv->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAttributeAv() only accepts arguments of type AttributeAv or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeAv relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeAvDescQuery The current query, for fluid interface
*/
public function joinAttributeAv($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeAv');
// 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, 'AttributeAv');
}
return $this;
}
/**
* Use the AttributeAv relation AttributeAv 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\AttributeAvQuery A secondary query class using the current class as primary query
*/
public function useAttributeAvQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeAv($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeAv', '\Thelia\Model\AttributeAvQuery');
}
/**
* Exclude object from result
*
* @param AttributeAvDesc $attributeAvDesc Object to remove from the list of results
*
* @return AttributeAvDescQuery The current query, for fluid interface
*/
public function prune($attributeAvDesc = null)
{
if ($attributeAvDesc) {
$this->addUsingAlias(AttributeAvDescPeer::ID, $attributeAvDesc->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,684 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Attribute;
use Thelia\Model\AttributeAv;
use Thelia\Model\AttributeAvDesc;
use Thelia\Model\AttributeAvPeer;
use Thelia\Model\AttributeAvQuery;
use Thelia\Model\AttributeCombination;
/**
* Base class that represents a query for the 'attribute_av' table.
*
*
*
* @method AttributeAvQuery orderById($order = Criteria::ASC) Order by the id column
* @method AttributeAvQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column
* @method AttributeAvQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method AttributeAvQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AttributeAvQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AttributeAvQuery groupById() Group by the id column
* @method AttributeAvQuery groupByAttributeId() Group by the attribute_id column
* @method AttributeAvQuery groupByPosition() Group by the position column
* @method AttributeAvQuery groupByCreatedAt() Group by the created_at column
* @method AttributeAvQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AttributeAvQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AttributeAvQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AttributeAvQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AttributeAvQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
* @method AttributeAvQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
* @method AttributeAvQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
*
* @method AttributeAvQuery leftJoinAttributeAvDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeAvDesc relation
* @method AttributeAvQuery rightJoinAttributeAvDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeAvDesc relation
* @method AttributeAvQuery innerJoinAttributeAvDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeAvDesc relation
*
* @method AttributeAvQuery leftJoinAttributeCombination($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCombination relation
* @method AttributeAvQuery rightJoinAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCombination relation
* @method AttributeAvQuery innerJoinAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCombination relation
*
* @method AttributeAv findOne(PropelPDO $con = null) Return the first AttributeAv matching the query
* @method AttributeAv findOneOrCreate(PropelPDO $con = null) Return the first AttributeAv matching the query, or a new AttributeAv object populated from the query conditions when no match is found
*
* @method AttributeAv findOneById(int $id) Return the first AttributeAv filtered by the id column
* @method AttributeAv findOneByAttributeId(int $attribute_id) Return the first AttributeAv filtered by the attribute_id column
* @method AttributeAv findOneByPosition(int $position) Return the first AttributeAv filtered by the position column
* @method AttributeAv findOneByCreatedAt(string $created_at) Return the first AttributeAv filtered by the created_at column
* @method AttributeAv findOneByUpdatedAt(string $updated_at) Return the first AttributeAv filtered by the updated_at column
*
* @method array findById(int $id) Return AttributeAv objects filtered by the id column
* @method array findByAttributeId(int $attribute_id) Return AttributeAv objects filtered by the attribute_id column
* @method array findByPosition(int $position) Return AttributeAv objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return AttributeAv objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return AttributeAv objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAttributeAvQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAttributeAvQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AttributeAv', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AttributeAvQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AttributeAvQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AttributeAvQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AttributeAvQuery) {
return $criteria;
}
$query = new AttributeAvQuery();
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 PropelPDO $con an optional connection object
*
* @return AttributeAv|AttributeAv[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AttributeAvPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AttributeAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AttributeAv A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `ATTRIBUTE_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_av` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new AttributeAv();
$obj->hydrate($row);
AttributeAvPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AttributeAv|AttributeAv[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|AttributeAv[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AttributeAvQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AttributeAvPeer::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 AttributeAvQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AttributeAvPeer::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 AttributeAvQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AttributeAvPeer::ID, $id, $comparison);
}
/**
* Filter the query on the attribute_id column
*
* Example usage:
* <code>
* $query->filterByAttributeId(1234); // WHERE attribute_id = 1234
* $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34)
* $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
* </code>
*
* @see filterByAttribute()
*
* @param mixed $attributeId 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 AttributeAvQuery The current query, for fluid interface
*/
public function filterByAttributeId($attributeId = null, $comparison = null)
{
if (is_array($attributeId)) {
$useMinMax = false;
if (isset($attributeId['min'])) {
$this->addUsingAlias(AttributeAvPeer::ATTRIBUTE_ID, $attributeId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($attributeId['max'])) {
$this->addUsingAlias(AttributeAvPeer::ATTRIBUTE_ID, $attributeId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeAvPeer::ATTRIBUTE_ID, $attributeId, $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 AttributeAvQuery 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(AttributeAvPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(AttributeAvPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeAvPeer::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 AttributeAvQuery 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(AttributeAvPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AttributeAvPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeAvPeer::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 AttributeAvQuery 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(AttributeAvPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AttributeAvPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeAvPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Attribute object
*
* @param Attribute|PropelObjectCollection $attribute The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeAvQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttribute($attribute, $comparison = null)
{
if ($attribute instanceof Attribute) {
return $this
->addUsingAlias(AttributeAvPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
} elseif ($attribute instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AttributeAvPeer::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAttribute() only accepts arguments of type Attribute or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Attribute relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeAvQuery The current query, for fluid interface
*/
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Attribute');
// 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, 'Attribute');
}
return $this;
}
/**
* Use the Attribute relation Attribute 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\AttributeQuery A secondary query class using the current class as primary query
*/
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttribute($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
}
/**
* Filter the query by a related AttributeAvDesc object
*
* @param AttributeAvDesc|PropelObjectCollection $attributeAvDesc the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeAvQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttributeAvDesc($attributeAvDesc, $comparison = null)
{
if ($attributeAvDesc instanceof AttributeAvDesc) {
return $this
->addUsingAlias(AttributeAvPeer::ID, $attributeAvDesc->getAttributeAvId(), $comparison);
} elseif ($attributeAvDesc instanceof PropelObjectCollection) {
return $this
->useAttributeAvDescQuery()
->filterByPrimaryKeys($attributeAvDesc->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAttributeAvDesc() only accepts arguments of type AttributeAvDesc or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeAvDesc relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeAvQuery The current query, for fluid interface
*/
public function joinAttributeAvDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeAvDesc');
// 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, 'AttributeAvDesc');
}
return $this;
}
/**
* Use the AttributeAvDesc relation AttributeAvDesc 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\AttributeAvDescQuery A secondary query class using the current class as primary query
*/
public function useAttributeAvDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeAvDesc($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeAvDesc', '\Thelia\Model\AttributeAvDescQuery');
}
/**
* Filter the query by a related AttributeCombination object
*
* @param AttributeCombination|PropelObjectCollection $attributeCombination the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeAvQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttributeCombination($attributeCombination, $comparison = null)
{
if ($attributeCombination instanceof AttributeCombination) {
return $this
->addUsingAlias(AttributeAvPeer::ID, $attributeCombination->getAttributeAvId(), $comparison);
} elseif ($attributeCombination instanceof PropelObjectCollection) {
return $this
->useAttributeCombinationQuery()
->filterByPrimaryKeys($attributeCombination->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAttributeCombination() only accepts arguments of type AttributeCombination or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeCombination relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeAvQuery The current query, for fluid interface
*/
public function joinAttributeCombination($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeCombination');
// 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, 'AttributeCombination');
}
return $this;
}
/**
* Use the AttributeCombination relation AttributeCombination 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\AttributeCombinationQuery A secondary query class using the current class as primary query
*/
public function useAttributeCombinationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeCombination($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeCombination', '\Thelia\Model\AttributeCombinationQuery');
}
/**
* Exclude object from result
*
* @param AttributeAv $attributeAv Object to remove from the list of results
*
* @return AttributeAvQuery The current query, for fluid interface
*/
public function prune($attributeAv = null)
{
if ($attributeAv) {
$this->addUsingAlias(AttributeAvPeer::ID, $attributeAv->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,609 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Attribute;
use Thelia\Model\AttributeCategory;
use Thelia\Model\AttributeCategoryPeer;
use Thelia\Model\AttributeCategoryQuery;
use Thelia\Model\Category;
/**
* Base class that represents a query for the 'attribute_category' table.
*
*
*
* @method AttributeCategoryQuery orderById($order = Criteria::ASC) Order by the id column
* @method AttributeCategoryQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column
* @method AttributeCategoryQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column
* @method AttributeCategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AttributeCategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AttributeCategoryQuery groupById() Group by the id column
* @method AttributeCategoryQuery groupByCategoryId() Group by the category_id column
* @method AttributeCategoryQuery groupByAttributeId() Group by the attribute_id column
* @method AttributeCategoryQuery groupByCreatedAt() Group by the created_at column
* @method AttributeCategoryQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AttributeCategoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AttributeCategoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AttributeCategoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AttributeCategoryQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
* @method AttributeCategoryQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
* @method AttributeCategoryQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
*
* @method AttributeCategoryQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
* @method AttributeCategoryQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
* @method AttributeCategoryQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
*
* @method AttributeCategory findOne(PropelPDO $con = null) Return the first AttributeCategory matching the query
* @method AttributeCategory findOneOrCreate(PropelPDO $con = null) Return the first AttributeCategory matching the query, or a new AttributeCategory object populated from the query conditions when no match is found
*
* @method AttributeCategory findOneById(int $id) Return the first AttributeCategory filtered by the id column
* @method AttributeCategory findOneByCategoryId(int $category_id) Return the first AttributeCategory filtered by the category_id column
* @method AttributeCategory findOneByAttributeId(int $attribute_id) Return the first AttributeCategory filtered by the attribute_id column
* @method AttributeCategory findOneByCreatedAt(string $created_at) Return the first AttributeCategory filtered by the created_at column
* @method AttributeCategory findOneByUpdatedAt(string $updated_at) Return the first AttributeCategory filtered by the updated_at column
*
* @method array findById(int $id) Return AttributeCategory objects filtered by the id column
* @method array findByCategoryId(int $category_id) Return AttributeCategory objects filtered by the category_id column
* @method array findByAttributeId(int $attribute_id) Return AttributeCategory objects filtered by the attribute_id column
* @method array findByCreatedAt(string $created_at) Return AttributeCategory objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return AttributeCategory objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAttributeCategoryQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAttributeCategoryQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AttributeCategory', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AttributeCategoryQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AttributeCategoryQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AttributeCategoryQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AttributeCategoryQuery) {
return $criteria;
}
$query = new AttributeCategoryQuery();
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 PropelPDO $con an optional connection object
*
* @return AttributeCategory|AttributeCategory[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AttributeCategoryPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AttributeCategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AttributeCategory A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `CATEGORY_ID`, `ATTRIBUTE_ID`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_category` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new AttributeCategory();
$obj->hydrate($row);
AttributeCategoryPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AttributeCategory|AttributeCategory[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|AttributeCategory[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AttributeCategoryQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AttributeCategoryPeer::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 AttributeCategoryQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AttributeCategoryPeer::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 AttributeCategoryQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AttributeCategoryPeer::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 AttributeCategoryQuery 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(AttributeCategoryPeer::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($categoryId['max'])) {
$this->addUsingAlias(AttributeCategoryPeer::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeCategoryPeer::CATEGORY_ID, $categoryId, $comparison);
}
/**
* Filter the query on the attribute_id column
*
* Example usage:
* <code>
* $query->filterByAttributeId(1234); // WHERE attribute_id = 1234
* $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34)
* $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
* </code>
*
* @see filterByAttribute()
*
* @param mixed $attributeId 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 AttributeCategoryQuery The current query, for fluid interface
*/
public function filterByAttributeId($attributeId = null, $comparison = null)
{
if (is_array($attributeId)) {
$useMinMax = false;
if (isset($attributeId['min'])) {
$this->addUsingAlias(AttributeCategoryPeer::ATTRIBUTE_ID, $attributeId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($attributeId['max'])) {
$this->addUsingAlias(AttributeCategoryPeer::ATTRIBUTE_ID, $attributeId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeCategoryPeer::ATTRIBUTE_ID, $attributeId, $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 AttributeCategoryQuery 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(AttributeCategoryPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AttributeCategoryPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeCategoryPeer::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 AttributeCategoryQuery 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(AttributeCategoryPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AttributeCategoryPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeCategoryPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Category object
*
* @param Category|PropelObjectCollection $category The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeCategoryQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCategory($category, $comparison = null)
{
if ($category instanceof Category) {
return $this
->addUsingAlias(AttributeCategoryPeer::CATEGORY_ID, $category->getId(), $comparison);
} elseif ($category instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AttributeCategoryPeer::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCategory() only accepts arguments of type Category or PropelCollection');
}
}
/**
* 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 AttributeCategoryQuery 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 Attribute object
*
* @param Attribute|PropelObjectCollection $attribute The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeCategoryQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttribute($attribute, $comparison = null)
{
if ($attribute instanceof Attribute) {
return $this
->addUsingAlias(AttributeCategoryPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
} elseif ($attribute instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AttributeCategoryPeer::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAttribute() only accepts arguments of type Attribute or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Attribute relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeCategoryQuery The current query, for fluid interface
*/
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Attribute');
// 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, 'Attribute');
}
return $this;
}
/**
* Use the Attribute relation Attribute 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\AttributeQuery A secondary query class using the current class as primary query
*/
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttribute($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
}
/**
* Exclude object from result
*
* @param AttributeCategory $attributeCategory Object to remove from the list of results
*
* @return AttributeCategoryQuery The current query, for fluid interface
*/
public function prune($attributeCategory = null)
{
if ($attributeCategory) {
$this->addUsingAlias(AttributeCategoryPeer::ID, $attributeCategory->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,720 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Attribute;
use Thelia\Model\AttributeAv;
use Thelia\Model\AttributeCombination;
use Thelia\Model\AttributeCombinationPeer;
use Thelia\Model\AttributeCombinationQuery;
use Thelia\Model\Combination;
/**
* Base class that represents a query for the 'attribute_combination' table.
*
*
*
* @method AttributeCombinationQuery orderById($order = Criteria::ASC) Order by the id column
* @method AttributeCombinationQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column
* @method AttributeCombinationQuery orderByCombinationId($order = Criteria::ASC) Order by the combination_id column
* @method AttributeCombinationQuery orderByAttributeAvId($order = Criteria::ASC) Order by the attribute_av_id column
* @method AttributeCombinationQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AttributeCombinationQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_At column
*
* @method AttributeCombinationQuery groupById() Group by the id column
* @method AttributeCombinationQuery groupByAttributeId() Group by the attribute_id column
* @method AttributeCombinationQuery groupByCombinationId() Group by the combination_id column
* @method AttributeCombinationQuery groupByAttributeAvId() Group by the attribute_av_id column
* @method AttributeCombinationQuery groupByCreatedAt() Group by the created_at column
* @method AttributeCombinationQuery groupByUpdatedAt() Group by the updated_At column
*
* @method AttributeCombinationQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AttributeCombinationQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AttributeCombinationQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AttributeCombinationQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
* @method AttributeCombinationQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
* @method AttributeCombinationQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
*
* @method AttributeCombinationQuery leftJoinAttributeAv($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeAv relation
* @method AttributeCombinationQuery rightJoinAttributeAv($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeAv relation
* @method AttributeCombinationQuery innerJoinAttributeAv($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeAv relation
*
* @method AttributeCombinationQuery leftJoinCombination($relationAlias = null) Adds a LEFT JOIN clause to the query using the Combination relation
* @method AttributeCombinationQuery rightJoinCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Combination relation
* @method AttributeCombinationQuery innerJoinCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the Combination relation
*
* @method AttributeCombination findOne(PropelPDO $con = null) Return the first AttributeCombination matching the query
* @method AttributeCombination findOneOrCreate(PropelPDO $con = null) Return the first AttributeCombination matching the query, or a new AttributeCombination object populated from the query conditions when no match is found
*
* @method AttributeCombination findOneById(int $id) Return the first AttributeCombination filtered by the id column
* @method AttributeCombination findOneByAttributeId(int $attribute_id) Return the first AttributeCombination filtered by the attribute_id column
* @method AttributeCombination findOneByCombinationId(int $combination_id) Return the first AttributeCombination filtered by the combination_id column
* @method AttributeCombination findOneByAttributeAvId(int $attribute_av_id) Return the first AttributeCombination filtered by the attribute_av_id column
* @method AttributeCombination findOneByCreatedAt(string $created_at) Return the first AttributeCombination filtered by the created_at column
* @method AttributeCombination findOneByUpdatedAt(string $updated_At) Return the first AttributeCombination filtered by the updated_At column
*
* @method array findById(int $id) Return AttributeCombination objects filtered by the id column
* @method array findByAttributeId(int $attribute_id) Return AttributeCombination objects filtered by the attribute_id column
* @method array findByCombinationId(int $combination_id) Return AttributeCombination objects filtered by the combination_id column
* @method array findByAttributeAvId(int $attribute_av_id) Return AttributeCombination objects filtered by the attribute_av_id column
* @method array findByCreatedAt(string $created_at) Return AttributeCombination objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_At) Return AttributeCombination objects filtered by the updated_At column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAttributeCombinationQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAttributeCombinationQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AttributeCombination', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AttributeCombinationQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AttributeCombinationQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AttributeCombinationQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AttributeCombinationQuery) {
return $criteria;
}
$query = new AttributeCombinationQuery();
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, 56, 78), $con);
* </code>
*
* @param array $key Primary key to use for the query
A Primary key composition: [$id, $attribute_id, $combination_id, $attribute_av_id]
* @param PropelPDO $con an optional connection object
*
* @return AttributeCombination|AttributeCombination[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AttributeCombinationPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1], (string) $key[2], (string) $key[3]))))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AttributeCombination A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `ATTRIBUTE_ID`, `COMBINATION_ID`, `ATTRIBUTE_AV_ID`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_combination` WHERE `ID` = :p0 AND `ATTRIBUTE_ID` = :p1 AND `COMBINATION_ID` = :p2 AND `ATTRIBUTE_AV_ID` = :p3';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->bindValue(':p2', $key[2], PDO::PARAM_INT);
$stmt->bindValue(':p3', $key[3], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new AttributeCombination();
$obj->hydrate($row);
AttributeCombinationPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1], (string) $key[2], (string) $key[3])));
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AttributeCombination|AttributeCombination[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|AttributeCombination[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AttributeCombinationQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(AttributeCombinationPeer::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $key[1], Criteria::EQUAL);
$this->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $key[2], Criteria::EQUAL);
$this->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $key[3], 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 AttributeCombinationQuery 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(AttributeCombinationPeer::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(AttributeCombinationPeer::ATTRIBUTE_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$cton2 = $this->getNewCriterion(AttributeCombinationPeer::COMBINATION_ID, $key[2], Criteria::EQUAL);
$cton0->addAnd($cton2);
$cton3 = $this->getNewCriterion(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $key[3], Criteria::EQUAL);
$cton0->addAnd($cton3);
$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>
*
* @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 AttributeCombinationQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AttributeCombinationPeer::ID, $id, $comparison);
}
/**
* Filter the query on the attribute_id column
*
* Example usage:
* <code>
* $query->filterByAttributeId(1234); // WHERE attribute_id = 1234
* $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34)
* $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
* </code>
*
* @see filterByAttribute()
*
* @param mixed $attributeId 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 AttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeId($attributeId = null, $comparison = null)
{
if (is_array($attributeId) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $attributeId, $comparison);
}
/**
* Filter the query on the combination_id column
*
* Example usage:
* <code>
* $query->filterByCombinationId(1234); // WHERE combination_id = 1234
* $query->filterByCombinationId(array(12, 34)); // WHERE combination_id IN (12, 34)
* $query->filterByCombinationId(array('min' => 12)); // WHERE combination_id > 12
* </code>
*
* @see filterByCombination()
*
* @param mixed $combinationId 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 AttributeCombinationQuery The current query, for fluid interface
*/
public function filterByCombinationId($combinationId = null, $comparison = null)
{
if (is_array($combinationId) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $combinationId, $comparison);
}
/**
* Filter the query on the attribute_av_id column
*
* Example usage:
* <code>
* $query->filterByAttributeAvId(1234); // WHERE attribute_av_id = 1234
* $query->filterByAttributeAvId(array(12, 34)); // WHERE attribute_av_id IN (12, 34)
* $query->filterByAttributeAvId(array('min' => 12)); // WHERE attribute_av_id > 12
* </code>
*
* @see filterByAttributeAv()
*
* @param mixed $attributeAvId 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 AttributeCombinationQuery The current query, for fluid interface
*/
public function filterByAttributeAvId($attributeAvId = null, $comparison = null)
{
if (is_array($attributeAvId) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attributeAvId, $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 AttributeCombinationQuery 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(AttributeCombinationPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AttributeCombinationPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeCombinationPeer::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 AttributeCombinationQuery 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(AttributeCombinationPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AttributeCombinationPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeCombinationPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Attribute object
*
* @param Attribute|PropelObjectCollection $attribute The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeCombinationQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttribute($attribute, $comparison = null)
{
if ($attribute instanceof Attribute) {
return $this
->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
} elseif ($attribute instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAttribute() only accepts arguments of type Attribute or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Attribute relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeCombinationQuery The current query, for fluid interface
*/
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Attribute');
// 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, 'Attribute');
}
return $this;
}
/**
* Use the Attribute relation Attribute 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\AttributeQuery A secondary query class using the current class as primary query
*/
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttribute($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
}
/**
* Filter the query by a related AttributeAv object
*
* @param AttributeAv|PropelObjectCollection $attributeAv The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeCombinationQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttributeAv($attributeAv, $comparison = null)
{
if ($attributeAv instanceof AttributeAv) {
return $this
->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attributeAv->getId(), $comparison);
} elseif ($attributeAv instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attributeAv->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAttributeAv() only accepts arguments of type AttributeAv or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeAv relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeCombinationQuery The current query, for fluid interface
*/
public function joinAttributeAv($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeAv');
// 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, 'AttributeAv');
}
return $this;
}
/**
* Use the AttributeAv relation AttributeAv 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\AttributeAvQuery A secondary query class using the current class as primary query
*/
public function useAttributeAvQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeAv($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeAv', '\Thelia\Model\AttributeAvQuery');
}
/**
* Filter the query by a related Combination object
*
* @param Combination|PropelObjectCollection $combination The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeCombinationQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCombination($combination, $comparison = null)
{
if ($combination instanceof Combination) {
return $this
->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $combination->getId(), $comparison);
} elseif ($combination instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $combination->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCombination() only accepts arguments of type Combination or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Combination relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeCombinationQuery The current query, for fluid interface
*/
public function joinCombination($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Combination');
// 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, 'Combination');
}
return $this;
}
/**
* Use the Combination relation Combination 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\CombinationQuery A secondary query class using the current class as primary query
*/
public function useCombinationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCombination($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Combination', '\Thelia\Model\CombinationQuery');
}
/**
* Exclude object from result
*
* @param AttributeCombination $attributeCombination Object to remove from the list of results
*
* @return AttributeCombinationQuery The current query, for fluid interface
*/
public function prune($attributeCombination = null)
{
if ($attributeCombination) {
$this->addCond('pruneCond0', $this->getAliasedColName(AttributeCombinationPeer::ID), $attributeCombination->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(AttributeCombinationPeer::ATTRIBUTE_ID), $attributeCombination->getAttributeId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond2', $this->getAliasedColName(AttributeCombinationPeer::COMBINATION_ID), $attributeCombination->getCombinationId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond3', $this->getAliasedColName(AttributeCombinationPeer::ATTRIBUTE_AV_ID), $attributeCombination->getAttributeAvId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1', 'pruneCond2', 'pruneCond3'), Criteria::LOGICAL_OR);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,613 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Attribute;
use Thelia\Model\AttributeDesc;
use Thelia\Model\AttributeDescPeer;
use Thelia\Model\AttributeDescQuery;
/**
* Base class that represents a query for the 'attribute_desc' table.
*
*
*
* @method AttributeDescQuery orderById($order = Criteria::ASC) Order by the id column
* @method AttributeDescQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method AttributeDescQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column
* @method AttributeDescQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method AttributeDescQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method AttributeDescQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method AttributeDescQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AttributeDescQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AttributeDescQuery groupById() Group by the id column
* @method AttributeDescQuery groupByLang() Group by the lang column
* @method AttributeDescQuery groupByAttributeId() Group by the attribute_id column
* @method AttributeDescQuery groupByTitle() Group by the title column
* @method AttributeDescQuery groupByDescription() Group by the description column
* @method AttributeDescQuery groupByChapo() Group by the chapo column
* @method AttributeDescQuery groupByCreatedAt() Group by the created_at column
* @method AttributeDescQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AttributeDescQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AttributeDescQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AttributeDescQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AttributeDescQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
* @method AttributeDescQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
* @method AttributeDescQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
*
* @method AttributeDesc findOne(PropelPDO $con = null) Return the first AttributeDesc matching the query
* @method AttributeDesc findOneOrCreate(PropelPDO $con = null) Return the first AttributeDesc matching the query, or a new AttributeDesc object populated from the query conditions when no match is found
*
* @method AttributeDesc findOneById(int $id) Return the first AttributeDesc filtered by the id column
* @method AttributeDesc findOneByLang(string $lang) Return the first AttributeDesc filtered by the lang column
* @method AttributeDesc findOneByAttributeId(int $attribute_id) Return the first AttributeDesc filtered by the attribute_id column
* @method AttributeDesc findOneByTitle(string $title) Return the first AttributeDesc filtered by the title column
* @method AttributeDesc findOneByDescription(string $description) Return the first AttributeDesc filtered by the description column
* @method AttributeDesc findOneByChapo(string $chapo) Return the first AttributeDesc filtered by the chapo column
* @method AttributeDesc findOneByCreatedAt(string $created_at) Return the first AttributeDesc filtered by the created_at column
* @method AttributeDesc findOneByUpdatedAt(string $updated_at) Return the first AttributeDesc filtered by the updated_at column
*
* @method array findById(int $id) Return AttributeDesc objects filtered by the id column
* @method array findByLang(string $lang) Return AttributeDesc objects filtered by the lang column
* @method array findByAttributeId(int $attribute_id) Return AttributeDesc objects filtered by the attribute_id column
* @method array findByTitle(string $title) Return AttributeDesc objects filtered by the title column
* @method array findByDescription(string $description) Return AttributeDesc objects filtered by the description column
* @method array findByChapo(string $chapo) Return AttributeDesc objects filtered by the chapo column
* @method array findByCreatedAt(string $created_at) Return AttributeDesc objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return AttributeDesc objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAttributeDescQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAttributeDescQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AttributeDesc', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AttributeDescQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AttributeDescQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AttributeDescQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AttributeDescQuery) {
return $criteria;
}
$query = new AttributeDescQuery();
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 PropelPDO $con an optional connection object
*
* @return AttributeDesc|AttributeDesc[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AttributeDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AttributeDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AttributeDesc A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `LANG`, `ATTRIBUTE_ID`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_desc` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new AttributeDesc();
$obj->hydrate($row);
AttributeDescPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AttributeDesc|AttributeDesc[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|AttributeDesc[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AttributeDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AttributeDescPeer::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 AttributeDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AttributeDescPeer::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 AttributeDescQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AttributeDescPeer::ID, $id, $comparison);
}
/**
* Filter the query on the lang column
*
* Example usage:
* <code>
* $query->filterByLang('fooValue'); // WHERE lang = 'fooValue'
* $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
* </code>
*
* @param string $lang 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 AttributeDescQuery The current query, for fluid interface
*/
public function filterByLang($lang = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lang)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lang)) {
$lang = str_replace('*', '%', $lang);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AttributeDescPeer::LANG, $lang, $comparison);
}
/**
* Filter the query on the attribute_id column
*
* Example usage:
* <code>
* $query->filterByAttributeId(1234); // WHERE attribute_id = 1234
* $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34)
* $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
* </code>
*
* @see filterByAttribute()
*
* @param mixed $attributeId 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 AttributeDescQuery The current query, for fluid interface
*/
public function filterByAttributeId($attributeId = null, $comparison = null)
{
if (is_array($attributeId)) {
$useMinMax = false;
if (isset($attributeId['min'])) {
$this->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attributeId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($attributeId['max'])) {
$this->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attributeId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attributeId, $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 AttributeDescQuery 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(AttributeDescPeer::TITLE, $title, $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 AttributeDescQuery 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(AttributeDescPeer::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo 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 AttributeDescQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AttributeDescPeer::CHAPO, $chapo, $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 AttributeDescQuery 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(AttributeDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AttributeDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeDescPeer::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 AttributeDescQuery 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(AttributeDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AttributeDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeDescPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Attribute object
*
* @param Attribute|PropelObjectCollection $attribute The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeDescQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttribute($attribute, $comparison = null)
{
if ($attribute instanceof Attribute) {
return $this
->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
} elseif ($attribute instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AttributeDescPeer::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAttribute() only accepts arguments of type Attribute or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Attribute relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeDescQuery The current query, for fluid interface
*/
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Attribute');
// 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, 'Attribute');
}
return $this;
}
/**
* Use the Attribute relation Attribute 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\AttributeQuery A secondary query class using the current class as primary query
*/
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttribute($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
}
/**
* Exclude object from result
*
* @param AttributeDesc $attributeDesc Object to remove from the list of results
*
* @return AttributeDescQuery The current query, for fluid interface
*/
public function prune($attributeDesc = null)
{
if ($attributeDesc) {
$this->addUsingAlias(AttributeDescPeer::ID, $attributeDesc->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

View File

@@ -0,0 +1,794 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\Attribute;
use Thelia\Model\AttributeAvPeer;
use Thelia\Model\AttributeCategoryPeer;
use Thelia\Model\AttributeCombinationPeer;
use Thelia\Model\AttributeDescPeer;
use Thelia\Model\AttributePeer;
use Thelia\Model\map\AttributeTableMap;
/**
* Base static class for performing query and update operations on the 'attribute' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAttributePeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'attribute';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\Attribute';
/** the related TableMap class for this table */
const TM_CLASS = 'AttributeTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 4;
/** 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 = 4;
/** the column name for the ID field */
const ID = 'attribute.ID';
/** the column name for the POSITION field */
const POSITION = 'attribute.POSITION';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'attribute.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'attribute.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of Attribute objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array Attribute[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. AttributePeer::$fieldNames[AttributePeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Position', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'position', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (AttributePeer::ID, AttributePeer::POSITION, AttributePeer::CREATED_AT, AttributePeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'position', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. AttributePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Position' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'position' => 1, 'createdAt' => 2, 'updatedAt' => 3, ),
BasePeer::TYPE_COLNAME => array (AttributePeer::ID => 0, AttributePeer::POSITION => 1, AttributePeer::CREATED_AT => 2, AttributePeer::UPDATED_AT => 3, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'POSITION' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'position' => 1, 'created_at' => 2, 'updated_at' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = AttributePeer::getFieldNames($toType);
$key = isset(AttributePeer::$fieldKeys[$fromType][$name]) ? AttributePeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AttributePeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, AttributePeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return AttributePeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. AttributePeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(AttributePeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(AttributePeer::ID);
$criteria->addSelectColumn(AttributePeer::POSITION);
$criteria->addSelectColumn(AttributePeer::CREATED_AT);
$criteria->addSelectColumn(AttributePeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(AttributePeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
AttributePeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(AttributePeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(AttributePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return Attribute
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = AttributePeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return AttributePeer::populateObjects(AttributePeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AttributePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
AttributePeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(AttributePeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Attribute $obj A Attribute object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
AttributePeer::$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 Attribute object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof Attribute) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Attribute object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(AttributePeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return Attribute Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(AttributePeer::$instances[$key])) {
return AttributePeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
AttributePeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to attribute
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in AttributeAvPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeAvPeer::clearInstancePool();
// Invalidate objects in AttributeCategoryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeCategoryPeer::clearInstancePool();
// Invalidate objects in AttributeCombinationPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeCombinationPeer::clearInstancePool();
// Invalidate objects in AttributeDescPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeDescPeer::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = AttributePeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = AttributePeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = AttributePeer::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;
AttributePeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (Attribute object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = AttributePeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + AttributePeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = AttributePeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
AttributePeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(AttributePeer::DATABASE_NAME)->getTable(AttributePeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseAttributePeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseAttributePeer::TABLE_NAME)) {
$dbMap->addTableObject(new AttributeTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return AttributePeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a Attribute or Criteria object.
*
* @param mixed $values Criteria or Attribute object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AttributePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Attribute object
}
if ($criteria->containsKey(AttributePeer::ID) && $criteria->keyContainsValue(AttributePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.AttributePeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(AttributePeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a Attribute or Criteria object.
*
* @param mixed $values Criteria or Attribute object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AttributePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(AttributePeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(AttributePeer::ID);
$value = $criteria->remove(AttributePeer::ID);
if ($value) {
$selectCriteria->add(AttributePeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(AttributePeer::TABLE_NAME);
}
} else { // $values is Attribute object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(AttributePeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the attribute table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AttributePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(AttributePeer::TABLE_NAME, $con, AttributePeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
AttributePeer::clearInstancePool();
AttributePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a Attribute or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Attribute object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AttributePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
AttributePeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof Attribute) { // it's a model object
// invalidate the cache for this single object
AttributePeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(AttributePeer::DATABASE_NAME);
$criteria->add(AttributePeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
AttributePeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(AttributePeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
AttributePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given Attribute object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param Attribute $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(AttributePeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(AttributePeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(AttributePeer::DATABASE_NAME, AttributePeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return Attribute
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = AttributePeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AttributePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(AttributePeer::DATABASE_NAME);
$criteria->add(AttributePeer::ID, $pk);
$v = AttributePeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return Attribute[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AttributePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(AttributePeer::DATABASE_NAME);
$criteria->add(AttributePeer::ID, $pks, Criteria::IN);
$objs = AttributePeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseAttributePeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseAttributePeer::buildTableMap();

View File

@@ -0,0 +1,714 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Attribute;
use Thelia\Model\AttributeAv;
use Thelia\Model\AttributeCategory;
use Thelia\Model\AttributeCombination;
use Thelia\Model\AttributeDesc;
use Thelia\Model\AttributePeer;
use Thelia\Model\AttributeQuery;
/**
* Base class that represents a query for the 'attribute' table.
*
*
*
* @method AttributeQuery orderById($order = Criteria::ASC) Order by the id column
* @method AttributeQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method AttributeQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method AttributeQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method AttributeQuery groupById() Group by the id column
* @method AttributeQuery groupByPosition() Group by the position column
* @method AttributeQuery groupByCreatedAt() Group by the created_at column
* @method AttributeQuery groupByUpdatedAt() Group by the updated_at column
*
* @method AttributeQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method AttributeQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AttributeQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method AttributeQuery leftJoinAttributeAv($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeAv relation
* @method AttributeQuery rightJoinAttributeAv($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeAv relation
* @method AttributeQuery innerJoinAttributeAv($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeAv relation
*
* @method AttributeQuery leftJoinAttributeCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCategory relation
* @method AttributeQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation
* @method AttributeQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation
*
* @method AttributeQuery leftJoinAttributeCombination($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCombination relation
* @method AttributeQuery rightJoinAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCombination relation
* @method AttributeQuery innerJoinAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCombination relation
*
* @method AttributeQuery leftJoinAttributeDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeDesc relation
* @method AttributeQuery rightJoinAttributeDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeDesc relation
* @method AttributeQuery innerJoinAttributeDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeDesc relation
*
* @method Attribute findOne(PropelPDO $con = null) Return the first Attribute matching the query
* @method Attribute findOneOrCreate(PropelPDO $con = null) Return the first Attribute matching the query, or a new Attribute object populated from the query conditions when no match is found
*
* @method Attribute findOneById(int $id) Return the first Attribute filtered by the id column
* @method Attribute findOneByPosition(int $position) Return the first Attribute filtered by the position column
* @method Attribute findOneByCreatedAt(string $created_at) Return the first Attribute filtered by the created_at column
* @method Attribute findOneByUpdatedAt(string $updated_at) Return the first Attribute filtered by the updated_at column
*
* @method array findById(int $id) Return Attribute objects filtered by the id column
* @method array findByPosition(int $position) Return Attribute objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return Attribute objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Attribute objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseAttributeQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseAttributeQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Attribute', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new AttributeQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param AttributeQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return AttributeQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof AttributeQuery) {
return $criteria;
}
$query = new AttributeQuery();
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 PropelPDO $con an optional connection object
*
* @return Attribute|Attribute[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AttributePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AttributePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Attribute A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `attribute` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Attribute();
$obj->hydrate($row);
AttributePeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Attribute|Attribute[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Attribute[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return AttributeQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AttributePeer::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 AttributeQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AttributePeer::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 AttributeQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(AttributePeer::ID, $id, $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 AttributeQuery 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(AttributePeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(AttributePeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributePeer::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 AttributeQuery 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(AttributePeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AttributePeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributePeer::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 AttributeQuery 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(AttributePeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AttributePeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributePeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related AttributeAv object
*
* @param AttributeAv|PropelObjectCollection $attributeAv the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttributeAv($attributeAv, $comparison = null)
{
if ($attributeAv instanceof AttributeAv) {
return $this
->addUsingAlias(AttributePeer::ID, $attributeAv->getAttributeId(), $comparison);
} elseif ($attributeAv instanceof PropelObjectCollection) {
return $this
->useAttributeAvQuery()
->filterByPrimaryKeys($attributeAv->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAttributeAv() only accepts arguments of type AttributeAv or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeAv relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeQuery The current query, for fluid interface
*/
public function joinAttributeAv($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeAv');
// 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, 'AttributeAv');
}
return $this;
}
/**
* Use the AttributeAv relation AttributeAv 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\AttributeAvQuery A secondary query class using the current class as primary query
*/
public function useAttributeAvQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeAv($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeAv', '\Thelia\Model\AttributeAvQuery');
}
/**
* Filter the query by a related AttributeCategory object
*
* @param AttributeCategory|PropelObjectCollection $attributeCategory the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttributeCategory($attributeCategory, $comparison = null)
{
if ($attributeCategory instanceof AttributeCategory) {
return $this
->addUsingAlias(AttributePeer::ID, $attributeCategory->getAttributeId(), $comparison);
} elseif ($attributeCategory instanceof PropelObjectCollection) {
return $this
->useAttributeCategoryQuery()
->filterByPrimaryKeys($attributeCategory->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAttributeCategory() only accepts arguments of type AttributeCategory or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeCategory relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeQuery The current query, for fluid interface
*/
public function joinAttributeCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeCategory');
// 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, 'AttributeCategory');
}
return $this;
}
/**
* Use the AttributeCategory relation AttributeCategory 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\AttributeCategoryQuery A secondary query class using the current class as primary query
*/
public function useAttributeCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
}
/**
* Filter the query by a related AttributeCombination object
*
* @param AttributeCombination|PropelObjectCollection $attributeCombination the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttributeCombination($attributeCombination, $comparison = null)
{
if ($attributeCombination instanceof AttributeCombination) {
return $this
->addUsingAlias(AttributePeer::ID, $attributeCombination->getAttributeId(), $comparison);
} elseif ($attributeCombination instanceof PropelObjectCollection) {
return $this
->useAttributeCombinationQuery()
->filterByPrimaryKeys($attributeCombination->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAttributeCombination() only accepts arguments of type AttributeCombination or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeCombination relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeQuery The current query, for fluid interface
*/
public function joinAttributeCombination($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeCombination');
// 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, 'AttributeCombination');
}
return $this;
}
/**
* Use the AttributeCombination relation AttributeCombination 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\AttributeCombinationQuery A secondary query class using the current class as primary query
*/
public function useAttributeCombinationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeCombination($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeCombination', '\Thelia\Model\AttributeCombinationQuery');
}
/**
* Filter the query by a related AttributeDesc object
*
* @param AttributeDesc|PropelObjectCollection $attributeDesc the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttributeDesc($attributeDesc, $comparison = null)
{
if ($attributeDesc instanceof AttributeDesc) {
return $this
->addUsingAlias(AttributePeer::ID, $attributeDesc->getAttributeId(), $comparison);
} elseif ($attributeDesc instanceof PropelObjectCollection) {
return $this
->useAttributeDescQuery()
->filterByPrimaryKeys($attributeDesc->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAttributeDesc() only accepts arguments of type AttributeDesc or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeDesc relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return AttributeQuery The current query, for fluid interface
*/
public function joinAttributeDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeDesc');
// 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, 'AttributeDesc');
}
return $this;
}
/**
* Use the AttributeDesc relation AttributeDesc 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\AttributeDescQuery A secondary query class using the current class as primary query
*/
public function useAttributeDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeDesc($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeDesc', '\Thelia\Model\AttributeDescQuery');
}
/**
* Exclude object from result
*
* @param Attribute $attribute Object to remove from the list of results
*
* @return AttributeQuery The current query, for fluid interface
*/
public function prune($attribute = null)
{
if ($attribute) {
$this->addUsingAlias(AttributePeer::ID, $attribute->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,646 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Category;
use Thelia\Model\CategoryDesc;
use Thelia\Model\CategoryDescPeer;
use Thelia\Model\CategoryDescQuery;
/**
* Base class that represents a query for the 'category_desc' table.
*
*
*
* @method CategoryDescQuery orderById($order = Criteria::ASC) Order by the id column
* @method CategoryDescQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column
* @method CategoryDescQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method CategoryDescQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method CategoryDescQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method CategoryDescQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method CategoryDescQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method CategoryDescQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method CategoryDescQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method CategoryDescQuery groupById() Group by the id column
* @method CategoryDescQuery groupByCategoryId() Group by the category_id column
* @method CategoryDescQuery groupByLang() Group by the lang column
* @method CategoryDescQuery groupByTitle() Group by the title column
* @method CategoryDescQuery groupByDescription() Group by the description column
* @method CategoryDescQuery groupByChapo() Group by the chapo column
* @method CategoryDescQuery groupByPostscriptum() Group by the postscriptum column
* @method CategoryDescQuery groupByCreatedAt() Group by the created_at column
* @method CategoryDescQuery groupByUpdatedAt() Group by the updated_at column
*
* @method CategoryDescQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CategoryDescQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CategoryDescQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CategoryDescQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
* @method CategoryDescQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
* @method CategoryDescQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
*
* @method CategoryDesc findOne(PropelPDO $con = null) Return the first CategoryDesc matching the query
* @method CategoryDesc findOneOrCreate(PropelPDO $con = null) Return the first CategoryDesc matching the query, or a new CategoryDesc object populated from the query conditions when no match is found
*
* @method CategoryDesc findOneById(int $id) Return the first CategoryDesc filtered by the id column
* @method CategoryDesc findOneByCategoryId(int $category_id) Return the first CategoryDesc filtered by the category_id column
* @method CategoryDesc findOneByLang(string $lang) Return the first CategoryDesc filtered by the lang column
* @method CategoryDesc findOneByTitle(string $title) Return the first CategoryDesc filtered by the title column
* @method CategoryDesc findOneByDescription(string $description) Return the first CategoryDesc filtered by the description column
* @method CategoryDesc findOneByChapo(string $chapo) Return the first CategoryDesc filtered by the chapo column
* @method CategoryDesc findOneByPostscriptum(string $postscriptum) Return the first CategoryDesc filtered by the postscriptum column
* @method CategoryDesc findOneByCreatedAt(string $created_at) Return the first CategoryDesc filtered by the created_at column
* @method CategoryDesc findOneByUpdatedAt(string $updated_at) Return the first CategoryDesc filtered by the updated_at column
*
* @method array findById(int $id) Return CategoryDesc objects filtered by the id column
* @method array findByCategoryId(int $category_id) Return CategoryDesc objects filtered by the category_id column
* @method array findByLang(string $lang) Return CategoryDesc objects filtered by the lang column
* @method array findByTitle(string $title) Return CategoryDesc objects filtered by the title column
* @method array findByDescription(string $description) Return CategoryDesc objects filtered by the description column
* @method array findByChapo(string $chapo) Return CategoryDesc objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return CategoryDesc objects filtered by the postscriptum column
* @method array findByCreatedAt(string $created_at) Return CategoryDesc objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return CategoryDesc objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCategoryDescQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCategoryDescQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\CategoryDesc', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CategoryDescQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CategoryDescQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CategoryDescQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CategoryDescQuery) {
return $criteria;
}
$query = new CategoryDescQuery();
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 PropelPDO $con an optional connection object
*
* @return CategoryDesc|CategoryDesc[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CategoryDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CategoryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CategoryDesc A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `CATEGORY_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `CREATED_AT`, `UPDATED_AT` FROM `category_desc` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CategoryDesc();
$obj->hydrate($row);
CategoryDescPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CategoryDesc|CategoryDesc[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|CategoryDesc[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CategoryDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CategoryDescPeer::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 CategoryDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CategoryDescPeer::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 CategoryDescQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CategoryDescPeer::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 CategoryDescQuery 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(CategoryDescPeer::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($categoryId['max'])) {
$this->addUsingAlias(CategoryDescPeer::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CategoryDescPeer::CATEGORY_ID, $categoryId, $comparison);
}
/**
* Filter the query on the lang column
*
* Example usage:
* <code>
* $query->filterByLang('fooValue'); // WHERE lang = 'fooValue'
* $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
* </code>
*
* @param string $lang 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 CategoryDescQuery The current query, for fluid interface
*/
public function filterByLang($lang = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lang)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lang)) {
$lang = str_replace('*', '%', $lang);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CategoryDescPeer::LANG, $lang, $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 CategoryDescQuery 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(CategoryDescPeer::TITLE, $title, $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 CategoryDescQuery 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(CategoryDescPeer::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo 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 CategoryDescQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CategoryDescPeer::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $postscriptum 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 CategoryDescQuery The current query, for fluid interface
*/
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CategoryDescPeer::POSTSCRIPTUM, $postscriptum, $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 CategoryDescQuery 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(CategoryDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CategoryDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CategoryDescPeer::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 CategoryDescQuery 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(CategoryDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CategoryDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CategoryDescPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Category object
*
* @param Category|PropelObjectCollection $category The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CategoryDescQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCategory($category, $comparison = null)
{
if ($category instanceof Category) {
return $this
->addUsingAlias(CategoryDescPeer::CATEGORY_ID, $category->getId(), $comparison);
} elseif ($category instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CategoryDescPeer::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCategory() only accepts arguments of type Category or PropelCollection');
}
}
/**
* 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 CategoryDescQuery 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');
}
/**
* Exclude object from result
*
* @param CategoryDesc $categoryDesc Object to remove from the list of results
*
* @return CategoryDescQuery The current query, for fluid interface
*/
public function prune($categoryDesc = null)
{
if ($categoryDesc) {
$this->addUsingAlias(CategoryDescPeer::ID, $categoryDesc->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

View File

@@ -0,0 +1,825 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\AttributeCategoryPeer;
use Thelia\Model\Category;
use Thelia\Model\CategoryDescPeer;
use Thelia\Model\CategoryPeer;
use Thelia\Model\ContentAssocPeer;
use Thelia\Model\DocumentPeer;
use Thelia\Model\FeatureCategoryPeer;
use Thelia\Model\ImagePeer;
use Thelia\Model\ProductCategoryPeer;
use Thelia\Model\RewritingPeer;
use Thelia\Model\map\CategoryTableMap;
/**
* Base static class for performing query and update operations on the 'category' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCategoryPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'category';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\Category';
/** the related TableMap class for this table */
const TM_CLASS = 'CategoryTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 7;
/** 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 = 7;
/** the column name for the ID field */
const ID = 'category.ID';
/** the column name for the PARENT field */
const PARENT = 'category.PARENT';
/** the column name for the LINK field */
const LINK = 'category.LINK';
/** the column name for the VISIBLE field */
const VISIBLE = 'category.VISIBLE';
/** the column name for the POSITION field */
const POSITION = 'category.POSITION';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'category.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'category.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of Category objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array Category[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. CategoryPeer::$fieldNames[CategoryPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Parent', 'Link', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'parent', 'link', 'visible', 'position', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (CategoryPeer::ID, CategoryPeer::PARENT, CategoryPeer::LINK, CategoryPeer::VISIBLE, CategoryPeer::POSITION, CategoryPeer::CREATED_AT, CategoryPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PARENT', 'LINK', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'parent', 'link', 'visible', 'position', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. CategoryPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Parent' => 1, 'Link' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
BasePeer::TYPE_COLNAME => array (CategoryPeer::ID => 0, CategoryPeer::PARENT => 1, CategoryPeer::LINK => 2, CategoryPeer::VISIBLE => 3, CategoryPeer::POSITION => 4, CategoryPeer::CREATED_AT => 5, CategoryPeer::UPDATED_AT => 6, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PARENT' => 1, 'LINK' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = CategoryPeer::getFieldNames($toType);
$key = isset(CategoryPeer::$fieldKeys[$fromType][$name]) ? CategoryPeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CategoryPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, CategoryPeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return CategoryPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CategoryPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CategoryPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(CategoryPeer::ID);
$criteria->addSelectColumn(CategoryPeer::PARENT);
$criteria->addSelectColumn(CategoryPeer::LINK);
$criteria->addSelectColumn(CategoryPeer::VISIBLE);
$criteria->addSelectColumn(CategoryPeer::POSITION);
$criteria->addSelectColumn(CategoryPeer::CREATED_AT);
$criteria->addSelectColumn(CategoryPeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PARENT');
$criteria->addSelectColumn($alias . '.LINK');
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CategoryPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CategoryPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(CategoryPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return Category
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = CategoryPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return CategoryPeer::populateObjects(CategoryPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CategoryPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(CategoryPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Category $obj A Category object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
CategoryPeer::$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 Category object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof Category) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Category object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(CategoryPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return Category Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(CategoryPeer::$instances[$key])) {
return CategoryPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
CategoryPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to category
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in AttributeCategoryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeCategoryPeer::clearInstancePool();
// Invalidate objects in CategoryDescPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CategoryDescPeer::clearInstancePool();
// Invalidate objects in ContentAssocPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ContentAssocPeer::clearInstancePool();
// Invalidate objects in DocumentPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
DocumentPeer::clearInstancePool();
// Invalidate objects in FeatureCategoryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
FeatureCategoryPeer::clearInstancePool();
// Invalidate objects in ImagePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ImagePeer::clearInstancePool();
// Invalidate objects in ProductCategoryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ProductCategoryPeer::clearInstancePool();
// Invalidate objects in RewritingPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
RewritingPeer::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = CategoryPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CategoryPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CategoryPeer::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;
CategoryPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (Category object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CategoryPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CategoryPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CategoryPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CategoryPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(CategoryPeer::DATABASE_NAME)->getTable(CategoryPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCategoryPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCategoryPeer::TABLE_NAME)) {
$dbMap->addTableObject(new CategoryTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return CategoryPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a Category or Criteria object.
*
* @param mixed $values Criteria or Category object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CategoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Category object
}
if ($criteria->containsKey(CategoryPeer::ID) && $criteria->keyContainsValue(CategoryPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CategoryPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(CategoryPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a Category or Criteria object.
*
* @param mixed $values Criteria or Category object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CategoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(CategoryPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CategoryPeer::ID);
$value = $criteria->remove(CategoryPeer::ID);
if ($value) {
$selectCriteria->add(CategoryPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CategoryPeer::TABLE_NAME);
}
} else { // $values is Category object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(CategoryPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the category table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CategoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(CategoryPeer::TABLE_NAME, $con, CategoryPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CategoryPeer::clearInstancePool();
CategoryPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a Category or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Category object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CategoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
CategoryPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof Category) { // it's a model object
// invalidate the cache for this single object
CategoryPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(CategoryPeer::DATABASE_NAME);
$criteria->add(CategoryPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CategoryPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(CategoryPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
CategoryPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given Category object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param Category $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CategoryPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CategoryPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(CategoryPeer::DATABASE_NAME, CategoryPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return Category
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CategoryPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CategoryPeer::DATABASE_NAME);
$criteria->add(CategoryPeer::ID, $pk);
$v = CategoryPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return Category[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CategoryPeer::DATABASE_NAME);
$criteria->add(CategoryPeer::ID, $pks, Criteria::IN);
$objs = CategoryPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCategoryPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCategoryPeer::buildTableMap();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,786 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\AttributeCombinationPeer;
use Thelia\Model\Combination;
use Thelia\Model\CombinationPeer;
use Thelia\Model\StockPeer;
use Thelia\Model\map\CombinationTableMap;
/**
* Base static class for performing query and update operations on the 'combination' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCombinationPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'combination';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\Combination';
/** the related TableMap class for this table */
const TM_CLASS = 'CombinationTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 4;
/** 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 = 4;
/** the column name for the ID field */
const ID = 'combination.ID';
/** the column name for the REF field */
const REF = 'combination.REF';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'combination.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'combination.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of Combination objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array Combination[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. CombinationPeer::$fieldNames[CombinationPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Ref', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'ref', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (CombinationPeer::ID, CombinationPeer::REF, CombinationPeer::CREATED_AT, CombinationPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'REF', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'ref', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. CombinationPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Ref' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'ref' => 1, 'createdAt' => 2, 'updatedAt' => 3, ),
BasePeer::TYPE_COLNAME => array (CombinationPeer::ID => 0, CombinationPeer::REF => 1, CombinationPeer::CREATED_AT => 2, CombinationPeer::UPDATED_AT => 3, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'REF' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'ref' => 1, 'created_at' => 2, 'updated_at' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = CombinationPeer::getFieldNames($toType);
$key = isset(CombinationPeer::$fieldKeys[$fromType][$name]) ? CombinationPeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CombinationPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, CombinationPeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return CombinationPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CombinationPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CombinationPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(CombinationPeer::ID);
$criteria->addSelectColumn(CombinationPeer::REF);
$criteria->addSelectColumn(CombinationPeer::CREATED_AT);
$criteria->addSelectColumn(CombinationPeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.REF');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CombinationPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CombinationPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(CombinationPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return Combination
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = CombinationPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return CombinationPeer::populateObjects(CombinationPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CombinationPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(CombinationPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Combination $obj A Combination object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
CombinationPeer::$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 Combination object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof Combination) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Combination object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(CombinationPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return Combination Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(CombinationPeer::$instances[$key])) {
return CombinationPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
CombinationPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to combination
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in AttributeCombinationPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeCombinationPeer::clearInstancePool();
// Invalidate objects in StockPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
StockPeer::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = CombinationPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CombinationPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CombinationPeer::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;
CombinationPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (Combination object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CombinationPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CombinationPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CombinationPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CombinationPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CombinationPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(CombinationPeer::DATABASE_NAME)->getTable(CombinationPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCombinationPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCombinationPeer::TABLE_NAME)) {
$dbMap->addTableObject(new CombinationTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return CombinationPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a Combination or Criteria object.
*
* @param mixed $values Criteria or Combination object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Combination object
}
if ($criteria->containsKey(CombinationPeer::ID) && $criteria->keyContainsValue(CombinationPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CombinationPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(CombinationPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a Combination or Criteria object.
*
* @param mixed $values Criteria or Combination object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(CombinationPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CombinationPeer::ID);
$value = $criteria->remove(CombinationPeer::ID);
if ($value) {
$selectCriteria->add(CombinationPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CombinationPeer::TABLE_NAME);
}
} else { // $values is Combination object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(CombinationPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the combination table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(CombinationPeer::TABLE_NAME, $con, CombinationPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CombinationPeer::clearInstancePool();
CombinationPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a Combination or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Combination object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
CombinationPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof Combination) { // it's a model object
// invalidate the cache for this single object
CombinationPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(CombinationPeer::DATABASE_NAME);
$criteria->add(CombinationPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CombinationPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(CombinationPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
CombinationPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given Combination object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param Combination $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CombinationPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CombinationPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(CombinationPeer::DATABASE_NAME, CombinationPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return Combination
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CombinationPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CombinationPeer::DATABASE_NAME);
$criteria->add(CombinationPeer::ID, $pk);
$v = CombinationPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return Combination[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CombinationPeer::DATABASE_NAME);
$criteria->add(CombinationPeer::ID, $pks, Criteria::IN);
$objs = CombinationPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCombinationPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCombinationPeer::buildTableMap();

View File

@@ -0,0 +1,544 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\AttributeCombination;
use Thelia\Model\Combination;
use Thelia\Model\CombinationPeer;
use Thelia\Model\CombinationQuery;
use Thelia\Model\Stock;
/**
* Base class that represents a query for the 'combination' table.
*
*
*
* @method CombinationQuery orderById($order = Criteria::ASC) Order by the id column
* @method CombinationQuery orderByRef($order = Criteria::ASC) Order by the ref column
* @method CombinationQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method CombinationQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method CombinationQuery groupById() Group by the id column
* @method CombinationQuery groupByRef() Group by the ref column
* @method CombinationQuery groupByCreatedAt() Group by the created_at column
* @method CombinationQuery groupByUpdatedAt() Group by the updated_at column
*
* @method CombinationQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CombinationQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CombinationQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CombinationQuery leftJoinAttributeCombination($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCombination relation
* @method CombinationQuery rightJoinAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCombination relation
* @method CombinationQuery innerJoinAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCombination relation
*
* @method CombinationQuery leftJoinStock($relationAlias = null) Adds a LEFT JOIN clause to the query using the Stock relation
* @method CombinationQuery rightJoinStock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Stock relation
* @method CombinationQuery innerJoinStock($relationAlias = null) Adds a INNER JOIN clause to the query using the Stock relation
*
* @method Combination findOne(PropelPDO $con = null) Return the first Combination matching the query
* @method Combination findOneOrCreate(PropelPDO $con = null) Return the first Combination matching the query, or a new Combination object populated from the query conditions when no match is found
*
* @method Combination findOneById(int $id) Return the first Combination filtered by the id column
* @method Combination findOneByRef(string $ref) Return the first Combination filtered by the ref column
* @method Combination findOneByCreatedAt(string $created_at) Return the first Combination filtered by the created_at column
* @method Combination findOneByUpdatedAt(string $updated_at) Return the first Combination filtered by the updated_at column
*
* @method array findById(int $id) Return Combination objects filtered by the id column
* @method array findByRef(string $ref) Return Combination objects filtered by the ref column
* @method array findByCreatedAt(string $created_at) Return Combination objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Combination objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCombinationQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCombinationQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Combination', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CombinationQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CombinationQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CombinationQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CombinationQuery) {
return $criteria;
}
$query = new CombinationQuery();
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 PropelPDO $con an optional connection object
*
* @return Combination|Combination[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CombinationPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Combination A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `REF`, `CREATED_AT`, `UPDATED_AT` FROM `combination` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Combination();
$obj->hydrate($row);
CombinationPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Combination|Combination[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Combination[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CombinationQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CombinationPeer::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 CombinationQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CombinationPeer::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 CombinationQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CombinationPeer::ID, $id, $comparison);
}
/**
* Filter the query on the ref column
*
* Example usage:
* <code>
* $query->filterByRef('fooValue'); // WHERE ref = 'fooValue'
* $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
* </code>
*
* @param string $ref 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 CombinationQuery The current query, for fluid interface
*/
public function filterByRef($ref = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($ref)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $ref)) {
$ref = str_replace('*', '%', $ref);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CombinationPeer::REF, $ref, $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 CombinationQuery 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(CombinationPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CombinationPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CombinationPeer::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 CombinationQuery 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(CombinationPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CombinationPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CombinationPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related AttributeCombination object
*
* @param AttributeCombination|PropelObjectCollection $attributeCombination the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CombinationQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAttributeCombination($attributeCombination, $comparison = null)
{
if ($attributeCombination instanceof AttributeCombination) {
return $this
->addUsingAlias(CombinationPeer::ID, $attributeCombination->getCombinationId(), $comparison);
} elseif ($attributeCombination instanceof PropelObjectCollection) {
return $this
->useAttributeCombinationQuery()
->filterByPrimaryKeys($attributeCombination->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAttributeCombination() only accepts arguments of type AttributeCombination or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeCombination relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CombinationQuery The current query, for fluid interface
*/
public function joinAttributeCombination($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeCombination');
// 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, 'AttributeCombination');
}
return $this;
}
/**
* Use the AttributeCombination relation AttributeCombination 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\AttributeCombinationQuery A secondary query class using the current class as primary query
*/
public function useAttributeCombinationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeCombination($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeCombination', '\Thelia\Model\AttributeCombinationQuery');
}
/**
* Filter the query by a related Stock object
*
* @param Stock|PropelObjectCollection $stock the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CombinationQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByStock($stock, $comparison = null)
{
if ($stock instanceof Stock) {
return $this
->addUsingAlias(CombinationPeer::ID, $stock->getCombinationId(), $comparison);
} elseif ($stock instanceof PropelObjectCollection) {
return $this
->useStockQuery()
->filterByPrimaryKeys($stock->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByStock() only accepts arguments of type Stock or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Stock relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CombinationQuery The current query, for fluid interface
*/
public function joinStock($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Stock');
// 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, 'Stock');
}
return $this;
}
/**
* Use the Stock relation Stock 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\StockQuery A secondary query class using the current class as primary query
*/
public function useStockQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinStock($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Stock', '\Thelia\Model\StockQuery');
}
/**
* Exclude object from result
*
* @param Combination $combination Object to remove from the list of results
*
* @return CombinationQuery The current query, for fluid interface
*/
public function prune($combination = null)
{
if ($combination) {
$this->addUsingAlias(CombinationPeer::ID, $combination->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,613 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Config;
use Thelia\Model\ConfigDesc;
use Thelia\Model\ConfigDescPeer;
use Thelia\Model\ConfigDescQuery;
/**
* Base class that represents a query for the 'config_desc' table.
*
*
*
* @method ConfigDescQuery orderById($order = Criteria::ASC) Order by the id column
* @method ConfigDescQuery orderByConfigId($order = Criteria::ASC) Order by the config_id column
* @method ConfigDescQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method ConfigDescQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ConfigDescQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ConfigDescQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ConfigDescQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ConfigDescQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ConfigDescQuery groupById() Group by the id column
* @method ConfigDescQuery groupByConfigId() Group by the config_id column
* @method ConfigDescQuery groupByLang() Group by the lang column
* @method ConfigDescQuery groupByTitle() Group by the title column
* @method ConfigDescQuery groupByDescription() Group by the description column
* @method ConfigDescQuery groupByChapo() Group by the chapo column
* @method ConfigDescQuery groupByCreatedAt() Group by the created_at column
* @method ConfigDescQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ConfigDescQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ConfigDescQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ConfigDescQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ConfigDescQuery leftJoinConfig($relationAlias = null) Adds a LEFT JOIN clause to the query using the Config relation
* @method ConfigDescQuery rightJoinConfig($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Config relation
* @method ConfigDescQuery innerJoinConfig($relationAlias = null) Adds a INNER JOIN clause to the query using the Config relation
*
* @method ConfigDesc findOne(PropelPDO $con = null) Return the first ConfigDesc matching the query
* @method ConfigDesc findOneOrCreate(PropelPDO $con = null) Return the first ConfigDesc matching the query, or a new ConfigDesc object populated from the query conditions when no match is found
*
* @method ConfigDesc findOneById(int $id) Return the first ConfigDesc filtered by the id column
* @method ConfigDesc findOneByConfigId(int $config_id) Return the first ConfigDesc filtered by the config_id column
* @method ConfigDesc findOneByLang(string $lang) Return the first ConfigDesc filtered by the lang column
* @method ConfigDesc findOneByTitle(string $title) Return the first ConfigDesc filtered by the title column
* @method ConfigDesc findOneByDescription(string $description) Return the first ConfigDesc filtered by the description column
* @method ConfigDesc findOneByChapo(string $chapo) Return the first ConfigDesc filtered by the chapo column
* @method ConfigDesc findOneByCreatedAt(string $created_at) Return the first ConfigDesc filtered by the created_at column
* @method ConfigDesc findOneByUpdatedAt(string $updated_at) Return the first ConfigDesc filtered by the updated_at column
*
* @method array findById(int $id) Return ConfigDesc objects filtered by the id column
* @method array findByConfigId(int $config_id) Return ConfigDesc objects filtered by the config_id column
* @method array findByLang(string $lang) Return ConfigDesc objects filtered by the lang column
* @method array findByTitle(string $title) Return ConfigDesc objects filtered by the title column
* @method array findByDescription(string $description) Return ConfigDesc objects filtered by the description column
* @method array findByChapo(string $chapo) Return ConfigDesc objects filtered by the chapo column
* @method array findByCreatedAt(string $created_at) Return ConfigDesc objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ConfigDesc objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseConfigDescQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseConfigDescQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\ConfigDesc', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ConfigDescQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param ConfigDescQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return ConfigDescQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof ConfigDescQuery) {
return $criteria;
}
$query = new ConfigDescQuery();
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 PropelPDO $con an optional connection object
*
* @return ConfigDesc|ConfigDesc[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ConfigDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(ConfigDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ConfigDesc A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `CONFIG_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `config_desc` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new ConfigDesc();
$obj->hydrate($row);
ConfigDescPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ConfigDesc|ConfigDesc[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|ConfigDesc[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ConfigDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(ConfigDescPeer::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 ConfigDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ConfigDescPeer::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 ConfigDescQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(ConfigDescPeer::ID, $id, $comparison);
}
/**
* Filter the query on the config_id column
*
* Example usage:
* <code>
* $query->filterByConfigId(1234); // WHERE config_id = 1234
* $query->filterByConfigId(array(12, 34)); // WHERE config_id IN (12, 34)
* $query->filterByConfigId(array('min' => 12)); // WHERE config_id > 12
* </code>
*
* @see filterByConfig()
*
* @param mixed $configId 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 ConfigDescQuery The current query, for fluid interface
*/
public function filterByConfigId($configId = null, $comparison = null)
{
if (is_array($configId)) {
$useMinMax = false;
if (isset($configId['min'])) {
$this->addUsingAlias(ConfigDescPeer::CONFIG_ID, $configId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($configId['max'])) {
$this->addUsingAlias(ConfigDescPeer::CONFIG_ID, $configId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ConfigDescPeer::CONFIG_ID, $configId, $comparison);
}
/**
* Filter the query on the lang column
*
* Example usage:
* <code>
* $query->filterByLang('fooValue'); // WHERE lang = 'fooValue'
* $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
* </code>
*
* @param string $lang 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 ConfigDescQuery The current query, for fluid interface
*/
public function filterByLang($lang = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lang)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lang)) {
$lang = str_replace('*', '%', $lang);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ConfigDescPeer::LANG, $lang, $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 ConfigDescQuery 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(ConfigDescPeer::TITLE, $title, $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 ConfigDescQuery 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(ConfigDescPeer::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo 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 ConfigDescQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ConfigDescPeer::CHAPO, $chapo, $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 ConfigDescQuery 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(ConfigDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(ConfigDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ConfigDescPeer::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 ConfigDescQuery 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(ConfigDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(ConfigDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ConfigDescPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Config object
*
* @param Config|PropelObjectCollection $config The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ConfigDescQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByConfig($config, $comparison = null)
{
if ($config instanceof Config) {
return $this
->addUsingAlias(ConfigDescPeer::CONFIG_ID, $config->getId(), $comparison);
} elseif ($config instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ConfigDescPeer::CONFIG_ID, $config->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByConfig() only accepts arguments of type Config or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Config relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ConfigDescQuery The current query, for fluid interface
*/
public function joinConfig($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Config');
// 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, 'Config');
}
return $this;
}
/**
* Use the Config relation Config 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\ConfigQuery A secondary query class using the current class as primary query
*/
public function useConfigQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinConfig($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Config', '\Thelia\Model\ConfigQuery');
}
/**
* Exclude object from result
*
* @param ConfigDesc $configDesc Object to remove from the list of results
*
* @return ConfigDescQuery The current query, for fluid interface
*/
public function prune($configDesc = null)
{
if ($configDesc) {
$this->addUsingAlias(ConfigDescPeer::ID, $configDesc->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

View File

@@ -0,0 +1,797 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\Config;
use Thelia\Model\ConfigDescPeer;
use Thelia\Model\ConfigPeer;
use Thelia\Model\map\ConfigTableMap;
/**
* Base static class for performing query and update operations on the 'config' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseConfigPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'config';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\Config';
/** the related TableMap class for this table */
const TM_CLASS = 'ConfigTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 7;
/** 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 = 7;
/** the column name for the ID field */
const ID = 'config.ID';
/** the column name for the NAME field */
const NAME = 'config.NAME';
/** the column name for the VALUE field */
const VALUE = 'config.VALUE';
/** the column name for the SECURE field */
const SECURE = 'config.SECURE';
/** the column name for the HIDDEN field */
const HIDDEN = 'config.HIDDEN';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'config.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'config.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of Config objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array Config[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. ConfigPeer::$fieldNames[ConfigPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Name', 'Value', 'Secure', 'Hidden', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'value', 'secure', 'hidden', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (ConfigPeer::ID, ConfigPeer::NAME, ConfigPeer::VALUE, ConfigPeer::SECURE, ConfigPeer::HIDDEN, ConfigPeer::CREATED_AT, ConfigPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'VALUE', 'SECURE', 'HIDDEN', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'value', 'secure', 'hidden', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. ConfigPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'Value' => 2, 'Secure' => 3, 'Hidden' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'value' => 2, 'secure' => 3, 'hidden' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
BasePeer::TYPE_COLNAME => array (ConfigPeer::ID => 0, ConfigPeer::NAME => 1, ConfigPeer::VALUE => 2, ConfigPeer::SECURE => 3, ConfigPeer::HIDDEN => 4, ConfigPeer::CREATED_AT => 5, ConfigPeer::UPDATED_AT => 6, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'VALUE' => 2, 'SECURE' => 3, 'HIDDEN' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'value' => 2, 'secure' => 3, 'hidden' => 4, 'created_at' => 5, 'updated_at' => 6, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = ConfigPeer::getFieldNames($toType);
$key = isset(ConfigPeer::$fieldKeys[$fromType][$name]) ? ConfigPeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ConfigPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, ConfigPeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return ConfigPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. ConfigPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(ConfigPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(ConfigPeer::ID);
$criteria->addSelectColumn(ConfigPeer::NAME);
$criteria->addSelectColumn(ConfigPeer::VALUE);
$criteria->addSelectColumn(ConfigPeer::SECURE);
$criteria->addSelectColumn(ConfigPeer::HIDDEN);
$criteria->addSelectColumn(ConfigPeer::CREATED_AT);
$criteria->addSelectColumn(ConfigPeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.VALUE');
$criteria->addSelectColumn($alias . '.SECURE');
$criteria->addSelectColumn($alias . '.HIDDEN');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(ConfigPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
ConfigPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(ConfigPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(ConfigPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return Config
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = ConfigPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return ConfigPeer::populateObjects(ConfigPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ConfigPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
ConfigPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(ConfigPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Config $obj A Config object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
ConfigPeer::$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 Config object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof Config) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Config object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(ConfigPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return Config Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(ConfigPeer::$instances[$key])) {
return ConfigPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
ConfigPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to config
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in ConfigDescPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ConfigDescPeer::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = ConfigPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = ConfigPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = ConfigPeer::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;
ConfigPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (Config object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = ConfigPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = ConfigPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + ConfigPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = ConfigPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
ConfigPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(ConfigPeer::DATABASE_NAME)->getTable(ConfigPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseConfigPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseConfigPeer::TABLE_NAME)) {
$dbMap->addTableObject(new ConfigTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return ConfigPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a Config or Criteria object.
*
* @param mixed $values Criteria or Config object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ConfigPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Config object
}
if ($criteria->containsKey(ConfigPeer::ID) && $criteria->keyContainsValue(ConfigPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ConfigPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(ConfigPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a Config or Criteria object.
*
* @param mixed $values Criteria or Config object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ConfigPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(ConfigPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(ConfigPeer::ID);
$value = $criteria->remove(ConfigPeer::ID);
if ($value) {
$selectCriteria->add(ConfigPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(ConfigPeer::TABLE_NAME);
}
} else { // $values is Config object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(ConfigPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the config table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ConfigPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(ConfigPeer::TABLE_NAME, $con, ConfigPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
ConfigPeer::clearInstancePool();
ConfigPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a Config or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Config object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ConfigPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
ConfigPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof Config) { // it's a model object
// invalidate the cache for this single object
ConfigPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(ConfigPeer::DATABASE_NAME);
$criteria->add(ConfigPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
ConfigPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(ConfigPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
ConfigPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given Config object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param Config $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(ConfigPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(ConfigPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(ConfigPeer::DATABASE_NAME, ConfigPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return Config
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = ConfigPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(ConfigPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(ConfigPeer::DATABASE_NAME);
$criteria->add(ConfigPeer::ID, $pk);
$v = ConfigPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return Config[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ConfigPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(ConfigPeer::DATABASE_NAME);
$criteria->add(ConfigPeer::ID, $pks, Criteria::IN);
$objs = ConfigPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseConfigPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseConfigPeer::buildTableMap();

View File

@@ -0,0 +1,588 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Config;
use Thelia\Model\ConfigDesc;
use Thelia\Model\ConfigPeer;
use Thelia\Model\ConfigQuery;
/**
* Base class that represents a query for the 'config' table.
*
*
*
* @method ConfigQuery orderById($order = Criteria::ASC) Order by the id column
* @method ConfigQuery orderByName($order = Criteria::ASC) Order by the name column
* @method ConfigQuery orderByValue($order = Criteria::ASC) Order by the value column
* @method ConfigQuery orderBySecure($order = Criteria::ASC) Order by the secure column
* @method ConfigQuery orderByHidden($order = Criteria::ASC) Order by the hidden column
* @method ConfigQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ConfigQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ConfigQuery groupById() Group by the id column
* @method ConfigQuery groupByName() Group by the name column
* @method ConfigQuery groupByValue() Group by the value column
* @method ConfigQuery groupBySecure() Group by the secure column
* @method ConfigQuery groupByHidden() Group by the hidden column
* @method ConfigQuery groupByCreatedAt() Group by the created_at column
* @method ConfigQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ConfigQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ConfigQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ConfigQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ConfigQuery leftJoinConfigDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ConfigDesc relation
* @method ConfigQuery rightJoinConfigDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ConfigDesc relation
* @method ConfigQuery innerJoinConfigDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the ConfigDesc relation
*
* @method Config findOne(PropelPDO $con = null) Return the first Config matching the query
* @method Config findOneOrCreate(PropelPDO $con = null) Return the first Config matching the query, or a new Config object populated from the query conditions when no match is found
*
* @method Config findOneById(int $id) Return the first Config filtered by the id column
* @method Config findOneByName(string $name) Return the first Config filtered by the name column
* @method Config findOneByValue(string $value) Return the first Config filtered by the value column
* @method Config findOneBySecure(int $secure) Return the first Config filtered by the secure column
* @method Config findOneByHidden(int $hidden) Return the first Config filtered by the hidden column
* @method Config findOneByCreatedAt(string $created_at) Return the first Config filtered by the created_at column
* @method Config findOneByUpdatedAt(string $updated_at) Return the first Config filtered by the updated_at column
*
* @method array findById(int $id) Return Config objects filtered by the id column
* @method array findByName(string $name) Return Config objects filtered by the name column
* @method array findByValue(string $value) Return Config objects filtered by the value column
* @method array findBySecure(int $secure) Return Config objects filtered by the secure column
* @method array findByHidden(int $hidden) Return Config objects filtered by the hidden column
* @method array findByCreatedAt(string $created_at) Return Config objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Config objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseConfigQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseConfigQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Config', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ConfigQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param ConfigQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return ConfigQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof ConfigQuery) {
return $criteria;
}
$query = new ConfigQuery();
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 PropelPDO $con an optional connection object
*
* @return Config|Config[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ConfigPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(ConfigPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Config A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `NAME`, `VALUE`, `SECURE`, `HIDDEN`, `CREATED_AT`, `UPDATED_AT` FROM `config` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Config();
$obj->hydrate($row);
ConfigPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Config|Config[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Config[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ConfigQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(ConfigPeer::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 ConfigQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ConfigPeer::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 ConfigQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(ConfigPeer::ID, $id, $comparison);
}
/**
* Filter the query on the name column
*
* Example usage:
* <code>
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
* </code>
*
* @param string $name The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ConfigQuery The current query, for fluid interface
*/
public function filterByName($name = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($name)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $name)) {
$name = str_replace('*', '%', $name);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ConfigPeer::NAME, $name, $comparison);
}
/**
* Filter the query on the value column
*
* Example usage:
* <code>
* $query->filterByValue('fooValue'); // WHERE value = 'fooValue'
* $query->filterByValue('%fooValue%'); // WHERE value LIKE '%fooValue%'
* </code>
*
* @param string $value The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ConfigQuery The current query, for fluid interface
*/
public function filterByValue($value = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($value)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $value)) {
$value = str_replace('*', '%', $value);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ConfigPeer::VALUE, $value, $comparison);
}
/**
* Filter the query on the secure column
*
* Example usage:
* <code>
* $query->filterBySecure(1234); // WHERE secure = 1234
* $query->filterBySecure(array(12, 34)); // WHERE secure IN (12, 34)
* $query->filterBySecure(array('min' => 12)); // WHERE secure > 12
* </code>
*
* @param mixed $secure 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 ConfigQuery The current query, for fluid interface
*/
public function filterBySecure($secure = null, $comparison = null)
{
if (is_array($secure)) {
$useMinMax = false;
if (isset($secure['min'])) {
$this->addUsingAlias(ConfigPeer::SECURE, $secure['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($secure['max'])) {
$this->addUsingAlias(ConfigPeer::SECURE, $secure['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ConfigPeer::SECURE, $secure, $comparison);
}
/**
* Filter the query on the hidden column
*
* Example usage:
* <code>
* $query->filterByHidden(1234); // WHERE hidden = 1234
* $query->filterByHidden(array(12, 34)); // WHERE hidden IN (12, 34)
* $query->filterByHidden(array('min' => 12)); // WHERE hidden > 12
* </code>
*
* @param mixed $hidden 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 ConfigQuery The current query, for fluid interface
*/
public function filterByHidden($hidden = null, $comparison = null)
{
if (is_array($hidden)) {
$useMinMax = false;
if (isset($hidden['min'])) {
$this->addUsingAlias(ConfigPeer::HIDDEN, $hidden['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($hidden['max'])) {
$this->addUsingAlias(ConfigPeer::HIDDEN, $hidden['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ConfigPeer::HIDDEN, $hidden, $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 ConfigQuery 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(ConfigPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(ConfigPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ConfigPeer::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 ConfigQuery 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(ConfigPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(ConfigPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ConfigPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related ConfigDesc object
*
* @param ConfigDesc|PropelObjectCollection $configDesc the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ConfigQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByConfigDesc($configDesc, $comparison = null)
{
if ($configDesc instanceof ConfigDesc) {
return $this
->addUsingAlias(ConfigPeer::ID, $configDesc->getConfigId(), $comparison);
} elseif ($configDesc instanceof PropelObjectCollection) {
return $this
->useConfigDescQuery()
->filterByPrimaryKeys($configDesc->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByConfigDesc() only accepts arguments of type ConfigDesc or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the ConfigDesc relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ConfigQuery The current query, for fluid interface
*/
public function joinConfigDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ConfigDesc');
// 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, 'ConfigDesc');
}
return $this;
}
/**
* Use the ConfigDesc relation ConfigDesc 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\ConfigDescQuery A secondary query class using the current class as primary query
*/
public function useConfigDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinConfigDesc($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ConfigDesc', '\Thelia\Model\ConfigDescQuery');
}
/**
* Exclude object from result
*
* @param Config $config Object to remove from the list of results
*
* @return ConfigQuery The current query, for fluid interface
*/
public function prune($config = null)
{
if ($config) {
$this->addUsingAlias(ConfigPeer::ID, $config->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,782 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Category;
use Thelia\Model\Content;
use Thelia\Model\ContentAssoc;
use Thelia\Model\ContentAssocPeer;
use Thelia\Model\ContentAssocQuery;
use Thelia\Model\Product;
/**
* Base class that represents a query for the 'content_assoc' table.
*
*
*
* @method ContentAssocQuery orderById($order = Criteria::ASC) Order by the id column
* @method ContentAssocQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column
* @method ContentAssocQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
* @method ContentAssocQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
* @method ContentAssocQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ContentAssocQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ContentAssocQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ContentAssocQuery groupById() Group by the id column
* @method ContentAssocQuery groupByCategoryId() Group by the category_id column
* @method ContentAssocQuery groupByProductId() Group by the product_id column
* @method ContentAssocQuery groupByContentId() Group by the content_id column
* @method ContentAssocQuery groupByPosition() Group by the position column
* @method ContentAssocQuery groupByCreatedAt() Group by the created_at column
* @method ContentAssocQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ContentAssocQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ContentAssocQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ContentAssocQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ContentAssocQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
* @method ContentAssocQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
* @method ContentAssocQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
*
* @method ContentAssocQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
* @method ContentAssocQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
* @method ContentAssocQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
*
* @method ContentAssocQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
* @method ContentAssocQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
* @method ContentAssocQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
*
* @method ContentAssoc findOne(PropelPDO $con = null) Return the first ContentAssoc matching the query
* @method ContentAssoc findOneOrCreate(PropelPDO $con = null) Return the first ContentAssoc matching the query, or a new ContentAssoc object populated from the query conditions when no match is found
*
* @method ContentAssoc findOneById(int $id) Return the first ContentAssoc filtered by the id column
* @method ContentAssoc findOneByCategoryId(int $category_id) Return the first ContentAssoc filtered by the category_id column
* @method ContentAssoc findOneByProductId(int $product_id) Return the first ContentAssoc filtered by the product_id column
* @method ContentAssoc findOneByContentId(int $content_id) Return the first ContentAssoc filtered by the content_id column
* @method ContentAssoc findOneByPosition(int $position) Return the first ContentAssoc filtered by the position column
* @method ContentAssoc findOneByCreatedAt(string $created_at) Return the first ContentAssoc filtered by the created_at column
* @method ContentAssoc findOneByUpdatedAt(string $updated_at) Return the first ContentAssoc filtered by the updated_at column
*
* @method array findById(int $id) Return ContentAssoc objects filtered by the id column
* @method array findByCategoryId(int $category_id) Return ContentAssoc objects filtered by the category_id column
* @method array findByProductId(int $product_id) Return ContentAssoc objects filtered by the product_id column
* @method array findByContentId(int $content_id) Return ContentAssoc objects filtered by the content_id column
* @method array findByPosition(int $position) Return ContentAssoc objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ContentAssoc objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ContentAssoc objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseContentAssocQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseContentAssocQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\ContentAssoc', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ContentAssocQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param ContentAssocQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return ContentAssocQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof ContentAssocQuery) {
return $criteria;
}
$query = new ContentAssocQuery();
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 PropelPDO $con an optional connection object
*
* @return ContentAssoc|ContentAssoc[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ContentAssocPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ContentAssoc A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `CATEGORY_ID`, `PRODUCT_ID`, `CONTENT_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `content_assoc` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new ContentAssoc();
$obj->hydrate($row);
ContentAssocPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ContentAssoc|ContentAssoc[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|ContentAssoc[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ContentAssocQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(ContentAssocPeer::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 ContentAssocQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ContentAssocPeer::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 ContentAssocQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(ContentAssocPeer::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 ContentAssocQuery 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(ContentAssocPeer::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($categoryId['max'])) {
$this->addUsingAlias(ContentAssocPeer::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocPeer::CATEGORY_ID, $categoryId, $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 ContentAssocQuery 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(ContentAssocPeer::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($productId['max'])) {
$this->addUsingAlias(ContentAssocPeer::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocPeer::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 ContentAssocQuery 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(ContentAssocPeer::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($contentId['max'])) {
$this->addUsingAlias(ContentAssocPeer::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocPeer::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 ContentAssocQuery 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(ContentAssocPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(ContentAssocPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocPeer::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 ContentAssocQuery 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(ContentAssocPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(ContentAssocPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocPeer::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 ContentAssocQuery 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(ContentAssocPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(ContentAssocPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentAssocPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Category object
*
* @param Category|PropelObjectCollection $category The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentAssocQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCategory($category, $comparison = null)
{
if ($category instanceof Category) {
return $this
->addUsingAlias(ContentAssocPeer::CATEGORY_ID, $category->getId(), $comparison);
} elseif ($category instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ContentAssocPeer::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCategory() only accepts arguments of type Category or PropelCollection');
}
}
/**
* 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 ContentAssocQuery The current query, for fluid interface
*/
public function joinCategory($relationAlias = null, $joinType = Criteria::LEFT_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::LEFT_JOIN)
{
return $this
->joinCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery');
}
/**
* Filter the query by a related Product object
*
* @param Product|PropelObjectCollection $product The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentAssocQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByProduct($product, $comparison = null)
{
if ($product instanceof Product) {
return $this
->addUsingAlias(ContentAssocPeer::PRODUCT_ID, $product->getId(), $comparison);
} elseif ($product instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ContentAssocPeer::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByProduct() only accepts arguments of type Product or PropelCollection');
}
}
/**
* 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 ContentAssocQuery The current query, for fluid interface
*/
public function joinProduct($relationAlias = null, $joinType = Criteria::LEFT_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::LEFT_JOIN)
{
return $this
->joinProduct($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
}
/**
* Filter the query by a related Content object
*
* @param Content|PropelObjectCollection $content The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentAssocQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByContent($content, $comparison = null)
{
if ($content instanceof Content) {
return $this
->addUsingAlias(ContentAssocPeer::CONTENT_ID, $content->getId(), $comparison);
} elseif ($content instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ContentAssocPeer::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByContent() only accepts arguments of type Content or PropelCollection');
}
}
/**
* 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 ContentAssocQuery The current query, for fluid interface
*/
public function joinContent($relationAlias = null, $joinType = Criteria::LEFT_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::LEFT_JOIN)
{
return $this
->joinContent($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery');
}
/**
* Exclude object from result
*
* @param ContentAssoc $contentAssoc Object to remove from the list of results
*
* @return ContentAssocQuery The current query, for fluid interface
*/
public function prune($contentAssoc = null)
{
if ($contentAssoc) {
$this->addUsingAlias(ContentAssocPeer::ID, $contentAssoc->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,646 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Content;
use Thelia\Model\ContentDesc;
use Thelia\Model\ContentDescPeer;
use Thelia\Model\ContentDescQuery;
/**
* Base class that represents a query for the 'content_desc' table.
*
*
*
* @method ContentDescQuery orderById($order = Criteria::ASC) Order by the id column
* @method ContentDescQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
* @method ContentDescQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method ContentDescQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ContentDescQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ContentDescQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ContentDescQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ContentDescQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ContentDescQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ContentDescQuery groupById() Group by the id column
* @method ContentDescQuery groupByContentId() Group by the content_id column
* @method ContentDescQuery groupByLang() Group by the lang column
* @method ContentDescQuery groupByTitle() Group by the title column
* @method ContentDescQuery groupByDescription() Group by the description column
* @method ContentDescQuery groupByChapo() Group by the chapo column
* @method ContentDescQuery groupByPostscriptum() Group by the postscriptum column
* @method ContentDescQuery groupByCreatedAt() Group by the created_at column
* @method ContentDescQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ContentDescQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ContentDescQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ContentDescQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ContentDescQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
* @method ContentDescQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
* @method ContentDescQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
*
* @method ContentDesc findOne(PropelPDO $con = null) Return the first ContentDesc matching the query
* @method ContentDesc findOneOrCreate(PropelPDO $con = null) Return the first ContentDesc matching the query, or a new ContentDesc object populated from the query conditions when no match is found
*
* @method ContentDesc findOneById(int $id) Return the first ContentDesc filtered by the id column
* @method ContentDesc findOneByContentId(int $content_id) Return the first ContentDesc filtered by the content_id column
* @method ContentDesc findOneByLang(string $lang) Return the first ContentDesc filtered by the lang column
* @method ContentDesc findOneByTitle(string $title) Return the first ContentDesc filtered by the title column
* @method ContentDesc findOneByDescription(string $description) Return the first ContentDesc filtered by the description column
* @method ContentDesc findOneByChapo(string $chapo) Return the first ContentDesc filtered by the chapo column
* @method ContentDesc findOneByPostscriptum(string $postscriptum) Return the first ContentDesc filtered by the postscriptum column
* @method ContentDesc findOneByCreatedAt(string $created_at) Return the first ContentDesc filtered by the created_at column
* @method ContentDesc findOneByUpdatedAt(string $updated_at) Return the first ContentDesc filtered by the updated_at column
*
* @method array findById(int $id) Return ContentDesc objects filtered by the id column
* @method array findByContentId(int $content_id) Return ContentDesc objects filtered by the content_id column
* @method array findByLang(string $lang) Return ContentDesc objects filtered by the lang column
* @method array findByTitle(string $title) Return ContentDesc objects filtered by the title column
* @method array findByDescription(string $description) Return ContentDesc objects filtered by the description column
* @method array findByChapo(string $chapo) Return ContentDesc objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ContentDesc objects filtered by the postscriptum column
* @method array findByCreatedAt(string $created_at) Return ContentDesc objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ContentDesc objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseContentDescQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseContentDescQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\ContentDesc', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ContentDescQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param ContentDescQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return ContentDescQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof ContentDescQuery) {
return $criteria;
}
$query = new ContentDescQuery();
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 PropelPDO $con an optional connection object
*
* @return ContentDesc|ContentDesc[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ContentDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(ContentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ContentDesc A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `CONTENT_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `CREATED_AT`, `UPDATED_AT` FROM `content_desc` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new ContentDesc();
$obj->hydrate($row);
ContentDescPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ContentDesc|ContentDesc[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|ContentDesc[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ContentDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(ContentDescPeer::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 ContentDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ContentDescPeer::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 ContentDescQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(ContentDescPeer::ID, $id, $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 ContentDescQuery 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(ContentDescPeer::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($contentId['max'])) {
$this->addUsingAlias(ContentDescPeer::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentDescPeer::CONTENT_ID, $contentId, $comparison);
}
/**
* Filter the query on the lang column
*
* Example usage:
* <code>
* $query->filterByLang('fooValue'); // WHERE lang = 'fooValue'
* $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
* </code>
*
* @param string $lang 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 ContentDescQuery The current query, for fluid interface
*/
public function filterByLang($lang = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lang)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lang)) {
$lang = str_replace('*', '%', $lang);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ContentDescPeer::LANG, $lang, $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 ContentDescQuery 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(ContentDescPeer::TITLE, $title, $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 ContentDescQuery 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(ContentDescPeer::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo 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 ContentDescQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ContentDescPeer::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $postscriptum 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 ContentDescQuery The current query, for fluid interface
*/
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ContentDescPeer::POSTSCRIPTUM, $postscriptum, $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 ContentDescQuery 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(ContentDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(ContentDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentDescPeer::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 ContentDescQuery 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(ContentDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(ContentDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentDescPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Content object
*
* @param Content|PropelObjectCollection $content The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentDescQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByContent($content, $comparison = null)
{
if ($content instanceof Content) {
return $this
->addUsingAlias(ContentDescPeer::CONTENT_ID, $content->getId(), $comparison);
} elseif ($content instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ContentDescPeer::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByContent() only accepts arguments of type Content or PropelCollection');
}
}
/**
* 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 ContentDescQuery 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 ContentDesc $contentDesc Object to remove from the list of results
*
* @return ContentDescQuery The current query, for fluid interface
*/
public function prune($contentDesc = null)
{
if ($contentDesc) {
$this->addUsingAlias(ContentDescPeer::ID, $contentDesc->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,471 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Content;
use Thelia\Model\ContentFolder;
use Thelia\Model\ContentFolderPeer;
use Thelia\Model\ContentFolderQuery;
use Thelia\Model\Folder;
/**
* Base class that represents a query for the 'content_folder' table.
*
*
*
* @method ContentFolderQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
* @method ContentFolderQuery orderByFolderId($order = Criteria::ASC) Order by the folder_id column
*
* @method ContentFolderQuery groupByContentId() Group by the content_id column
* @method ContentFolderQuery groupByFolderId() Group by the folder_id column
*
* @method ContentFolderQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ContentFolderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ContentFolderQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ContentFolderQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
* @method ContentFolderQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
* @method ContentFolderQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
*
* @method ContentFolderQuery leftJoinFolder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Folder relation
* @method ContentFolderQuery rightJoinFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Folder relation
* @method ContentFolderQuery innerJoinFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the Folder relation
*
* @method ContentFolder findOne(PropelPDO $con = null) Return the first ContentFolder matching the query
* @method ContentFolder findOneOrCreate(PropelPDO $con = null) Return the first ContentFolder matching the query, or a new ContentFolder object populated from the query conditions when no match is found
*
* @method ContentFolder findOneByContentId(int $content_id) Return the first ContentFolder filtered by the content_id column
* @method ContentFolder findOneByFolderId(int $folder_id) Return the first ContentFolder filtered by the folder_id column
*
* @method array findByContentId(int $content_id) Return ContentFolder objects filtered by the content_id column
* @method array findByFolderId(int $folder_id) Return ContentFolder objects filtered by the folder_id column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseContentFolderQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseContentFolderQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\ContentFolder', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ContentFolderQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param ContentFolderQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return ContentFolderQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof ContentFolderQuery) {
return $criteria;
}
$query = new ContentFolderQuery();
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 $key Primary key to use for the query
A Primary key composition: [$content_id, $folder_id]
* @param PropelPDO $con an optional connection object
*
* @return ContentFolder|ContentFolder[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ContentFolderPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(ContentFolderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ContentFolder A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `CONTENT_ID`, `FOLDER_ID` FROM `content_folder` WHERE `CONTENT_ID` = :p0 AND `FOLDER_ID` = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new ContentFolder();
$obj->hydrate($row);
ContentFolderPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ContentFolder|ContentFolder[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|ContentFolder[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ContentFolderQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(ContentFolderPeer::CONTENT_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(ContentFolderPeer::FOLDER_ID, $key[1], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ContentFolderQuery 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(ContentFolderPeer::CONTENT_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(ContentFolderPeer::FOLDER_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* 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 ContentFolderQuery The current query, for fluid interface
*/
public function filterByContentId($contentId = null, $comparison = null)
{
if (is_array($contentId) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(ContentFolderPeer::CONTENT_ID, $contentId, $comparison);
}
/**
* Filter the query on the folder_id column
*
* Example usage:
* <code>
* $query->filterByFolderId(1234); // WHERE folder_id = 1234
* $query->filterByFolderId(array(12, 34)); // WHERE folder_id IN (12, 34)
* $query->filterByFolderId(array('min' => 12)); // WHERE folder_id > 12
* </code>
*
* @see filterByFolder()
*
* @param mixed $folderId 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 ContentFolderQuery The current query, for fluid interface
*/
public function filterByFolderId($folderId = null, $comparison = null)
{
if (is_array($folderId) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(ContentFolderPeer::FOLDER_ID, $folderId, $comparison);
}
/**
* Filter the query by a related Content object
*
* @param Content|PropelObjectCollection $content The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentFolderQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByContent($content, $comparison = null)
{
if ($content instanceof Content) {
return $this
->addUsingAlias(ContentFolderPeer::CONTENT_ID, $content->getId(), $comparison);
} elseif ($content instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ContentFolderPeer::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByContent() only accepts arguments of type Content or PropelCollection');
}
}
/**
* 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 ContentFolderQuery 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');
}
/**
* Filter the query by a related Folder object
*
* @param Folder|PropelObjectCollection $folder The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentFolderQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByFolder($folder, $comparison = null)
{
if ($folder instanceof Folder) {
return $this
->addUsingAlias(ContentFolderPeer::FOLDER_ID, $folder->getId(), $comparison);
} elseif ($folder instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ContentFolderPeer::FOLDER_ID, $folder->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByFolder() only accepts arguments of type Folder or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Folder relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ContentFolderQuery The current query, for fluid interface
*/
public function joinFolder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Folder');
// 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, 'Folder');
}
return $this;
}
/**
* Use the Folder relation Folder 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\FolderQuery A secondary query class using the current class as primary query
*/
public function useFolderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinFolder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Folder', '\Thelia\Model\FolderQuery');
}
/**
* Exclude object from result
*
* @param ContentFolder $contentFolder Object to remove from the list of results
*
* @return ContentFolderQuery The current query, for fluid interface
*/
public function prune($contentFolder = null)
{
if ($contentFolder) {
$this->addCond('pruneCond0', $this->getAliasedColName(ContentFolderPeer::CONTENT_ID), $contentFolder->getContentId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(ContentFolderPeer::FOLDER_ID), $contentFolder->getFolderId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
}

View File

@@ -0,0 +1,807 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\Content;
use Thelia\Model\ContentAssocPeer;
use Thelia\Model\ContentDescPeer;
use Thelia\Model\ContentFolderPeer;
use Thelia\Model\ContentPeer;
use Thelia\Model\DocumentPeer;
use Thelia\Model\ImagePeer;
use Thelia\Model\RewritingPeer;
use Thelia\Model\map\ContentTableMap;
/**
* Base static class for performing query and update operations on the 'content' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseContentPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'content';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\Content';
/** the related TableMap class for this table */
const TM_CLASS = 'ContentTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 5;
/** 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 = 5;
/** the column name for the ID field */
const ID = 'content.ID';
/** the column name for the VISIBLE field */
const VISIBLE = 'content.VISIBLE';
/** the column name for the POSITION field */
const POSITION = 'content.POSITION';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'content.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'content.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of Content objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array Content[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. ContentPeer::$fieldNames[ContentPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'visible', 'position', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (ContentPeer::ID, ContentPeer::VISIBLE, ContentPeer::POSITION, ContentPeer::CREATED_AT, ContentPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'visible', 'position', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. ContentPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Visible' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'visible' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
BasePeer::TYPE_COLNAME => array (ContentPeer::ID => 0, ContentPeer::VISIBLE => 1, ContentPeer::POSITION => 2, ContentPeer::CREATED_AT => 3, ContentPeer::UPDATED_AT => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'visible' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = ContentPeer::getFieldNames($toType);
$key = isset(ContentPeer::$fieldKeys[$fromType][$name]) ? ContentPeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ContentPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, ContentPeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return ContentPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. ContentPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(ContentPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(ContentPeer::ID);
$criteria->addSelectColumn(ContentPeer::VISIBLE);
$criteria->addSelectColumn(ContentPeer::POSITION);
$criteria->addSelectColumn(ContentPeer::CREATED_AT);
$criteria->addSelectColumn(ContentPeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(ContentPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
ContentPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(ContentPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return Content
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = ContentPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return ContentPeer::populateObjects(ContentPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
ContentPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(ContentPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Content $obj A Content object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
ContentPeer::$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 Content object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof Content) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Content object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(ContentPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return Content Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(ContentPeer::$instances[$key])) {
return ContentPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
ContentPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to content
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in ContentAssocPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ContentAssocPeer::clearInstancePool();
// Invalidate objects in ContentDescPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ContentDescPeer::clearInstancePool();
// Invalidate objects in ContentFolderPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ContentFolderPeer::clearInstancePool();
// Invalidate objects in DocumentPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
DocumentPeer::clearInstancePool();
// Invalidate objects in ImagePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ImagePeer::clearInstancePool();
// Invalidate objects in RewritingPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
RewritingPeer::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = ContentPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = ContentPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = ContentPeer::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;
ContentPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (Content object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = ContentPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + ContentPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = ContentPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
ContentPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(ContentPeer::DATABASE_NAME)->getTable(ContentPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseContentPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseContentPeer::TABLE_NAME)) {
$dbMap->addTableObject(new ContentTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return ContentPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a Content or Criteria object.
*
* @param mixed $values Criteria or Content object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Content object
}
if ($criteria->containsKey(ContentPeer::ID) && $criteria->keyContainsValue(ContentPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ContentPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(ContentPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a Content or Criteria object.
*
* @param mixed $values Criteria or Content object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(ContentPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(ContentPeer::ID);
$value = $criteria->remove(ContentPeer::ID);
if ($value) {
$selectCriteria->add(ContentPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(ContentPeer::TABLE_NAME);
}
} else { // $values is Content object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(ContentPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the content table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(ContentPeer::TABLE_NAME, $con, ContentPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
ContentPeer::clearInstancePool();
ContentPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a Content or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Content object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
ContentPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof Content) { // it's a model object
// invalidate the cache for this single object
ContentPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(ContentPeer::DATABASE_NAME);
$criteria->add(ContentPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
ContentPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(ContentPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
ContentPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given Content object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param Content $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(ContentPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(ContentPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(ContentPeer::DATABASE_NAME, ContentPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return Content
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = ContentPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(ContentPeer::DATABASE_NAME);
$criteria->add(ContentPeer::ID, $pk);
$v = ContentPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return Content[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(ContentPeer::DATABASE_NAME);
$criteria->add(ContentPeer::ID, $pks, Criteria::IN);
$objs = ContentPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseContentPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseContentPeer::buildTableMap();

View File

@@ -0,0 +1,917 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Content;
use Thelia\Model\ContentAssoc;
use Thelia\Model\ContentDesc;
use Thelia\Model\ContentFolder;
use Thelia\Model\ContentPeer;
use Thelia\Model\ContentQuery;
use Thelia\Model\Document;
use Thelia\Model\Image;
use Thelia\Model\Rewriting;
/**
* Base class that represents a query for the 'content' table.
*
*
*
* @method ContentQuery orderById($order = Criteria::ASC) Order by the id column
* @method ContentQuery orderByVisible($order = Criteria::ASC) Order by the visible column
* @method ContentQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ContentQuery groupById() Group by the id column
* @method ContentQuery groupByVisible() Group by the visible column
* @method ContentQuery groupByPosition() Group by the position column
* @method ContentQuery groupByCreatedAt() Group by the created_at column
* @method ContentQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ContentQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation
* @method ContentQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation
* @method ContentQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation
*
* @method ContentQuery leftJoinContentDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentDesc relation
* @method ContentQuery rightJoinContentDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentDesc relation
* @method ContentQuery innerJoinContentDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentDesc relation
*
* @method ContentQuery leftJoinContentFolder($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentFolder relation
* @method ContentQuery rightJoinContentFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentFolder relation
* @method ContentQuery innerJoinContentFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentFolder relation
*
* @method ContentQuery leftJoinDocument($relationAlias = null) Adds a LEFT JOIN clause to the query using the Document relation
* @method ContentQuery rightJoinDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Document relation
* @method ContentQuery innerJoinDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the Document relation
*
* @method ContentQuery leftJoinImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the Image relation
* @method ContentQuery rightJoinImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Image relation
* @method ContentQuery innerJoinImage($relationAlias = null) Adds a INNER JOIN clause to the query using the Image relation
*
* @method ContentQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation
* @method ContentQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation
* @method ContentQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation
*
* @method Content findOne(PropelPDO $con = null) Return the first Content matching the query
* @method Content findOneOrCreate(PropelPDO $con = null) Return the first Content matching the query, or a new Content object populated from the query conditions when no match is found
*
* @method Content findOneById(int $id) Return the first Content filtered by the id column
* @method Content findOneByVisible(int $visible) Return the first Content filtered by the visible column
* @method Content findOneByPosition(int $position) Return the first Content filtered by the position column
* @method Content findOneByCreatedAt(string $created_at) Return the first Content filtered by the created_at column
* @method Content findOneByUpdatedAt(string $updated_at) Return the first Content filtered by the updated_at column
*
* @method array findById(int $id) Return Content objects filtered by the id column
* @method array findByVisible(int $visible) Return Content objects filtered by the visible column
* @method array findByPosition(int $position) Return Content objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return Content objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Content objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseContentQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseContentQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Content', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ContentQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param ContentQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return ContentQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof ContentQuery) {
return $criteria;
}
$query = new ContentQuery();
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 PropelPDO $con an optional connection object
*
* @return Content|Content[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ContentPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Content A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `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), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Content();
$obj->hydrate($row);
ContentPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Content|Content[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Content[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ContentQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(ContentPeer::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 ContentQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ContentPeer::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 ContentQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(ContentPeer::ID, $id, $comparison);
}
/**
* Filter the query on the visible column
*
* Example usage:
* <code>
* $query->filterByVisible(1234); // WHERE visible = 1234
* $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
* $query->filterByVisible(array('min' => 12)); // WHERE visible > 12
* </code>
*
* @param mixed $visible 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 ContentQuery The current query, for fluid interface
*/
public function filterByVisible($visible = null, $comparison = null)
{
if (is_array($visible)) {
$useMinMax = false;
if (isset($visible['min'])) {
$this->addUsingAlias(ContentPeer::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($visible['max'])) {
$this->addUsingAlias(ContentPeer::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentPeer::VISIBLE, $visible, $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 ContentQuery 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(ContentPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(ContentPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentPeer::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 ContentQuery 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(ContentPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(ContentPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentPeer::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 ContentQuery 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(ContentPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(ContentPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ContentPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related ContentAssoc object
*
* @param ContentAssoc|PropelObjectCollection $contentAssoc the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByContentAssoc($contentAssoc, $comparison = null)
{
if ($contentAssoc instanceof ContentAssoc) {
return $this
->addUsingAlias(ContentPeer::ID, $contentAssoc->getContentId(), $comparison);
} elseif ($contentAssoc instanceof PropelObjectCollection) {
return $this
->useContentAssocQuery()
->filterByPrimaryKeys($contentAssoc->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByContentAssoc() only accepts arguments of type ContentAssoc or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the ContentAssoc relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ContentQuery The current query, for fluid interface
*/
public function joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ContentAssoc');
// 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, 'ContentAssoc');
}
return $this;
}
/**
* Use the ContentAssoc relation ContentAssoc 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\ContentAssocQuery A secondary query class using the current class as primary query
*/
public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinContentAssoc($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery');
}
/**
* Filter the query by a related ContentDesc object
*
* @param ContentDesc|PropelObjectCollection $contentDesc the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByContentDesc($contentDesc, $comparison = null)
{
if ($contentDesc instanceof ContentDesc) {
return $this
->addUsingAlias(ContentPeer::ID, $contentDesc->getContentId(), $comparison);
} elseif ($contentDesc instanceof PropelObjectCollection) {
return $this
->useContentDescQuery()
->filterByPrimaryKeys($contentDesc->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByContentDesc() only accepts arguments of type ContentDesc or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the ContentDesc relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ContentQuery The current query, for fluid interface
*/
public function joinContentDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ContentDesc');
// 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, 'ContentDesc');
}
return $this;
}
/**
* Use the ContentDesc relation ContentDesc 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\ContentDescQuery A secondary query class using the current class as primary query
*/
public function useContentDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinContentDesc($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ContentDesc', '\Thelia\Model\ContentDescQuery');
}
/**
* Filter the query by a related ContentFolder object
*
* @param ContentFolder|PropelObjectCollection $contentFolder the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByContentFolder($contentFolder, $comparison = null)
{
if ($contentFolder instanceof ContentFolder) {
return $this
->addUsingAlias(ContentPeer::ID, $contentFolder->getContentId(), $comparison);
} elseif ($contentFolder instanceof PropelObjectCollection) {
return $this
->useContentFolderQuery()
->filterByPrimaryKeys($contentFolder->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByContentFolder() only accepts arguments of type ContentFolder or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the ContentFolder relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ContentQuery The current query, for fluid interface
*/
public function joinContentFolder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ContentFolder');
// 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, 'ContentFolder');
}
return $this;
}
/**
* Use the ContentFolder relation ContentFolder 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\ContentFolderQuery A secondary query class using the current class as primary query
*/
public function useContentFolderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinContentFolder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ContentFolder', '\Thelia\Model\ContentFolderQuery');
}
/**
* Filter the query by a related Document object
*
* @param Document|PropelObjectCollection $document the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByDocument($document, $comparison = null)
{
if ($document instanceof Document) {
return $this
->addUsingAlias(ContentPeer::ID, $document->getContentId(), $comparison);
} elseif ($document instanceof PropelObjectCollection) {
return $this
->useDocumentQuery()
->filterByPrimaryKeys($document->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByDocument() only accepts arguments of type Document or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Document relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ContentQuery The current query, for fluid interface
*/
public function joinDocument($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Document');
// 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, 'Document');
}
return $this;
}
/**
* Use the Document relation Document 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\DocumentQuery A secondary query class using the current class as primary query
*/
public function useDocumentQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinDocument($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Document', '\Thelia\Model\DocumentQuery');
}
/**
* Filter the query by a related Image object
*
* @param Image|PropelObjectCollection $image the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByImage($image, $comparison = null)
{
if ($image instanceof Image) {
return $this
->addUsingAlias(ContentPeer::ID, $image->getContentId(), $comparison);
} elseif ($image instanceof PropelObjectCollection) {
return $this
->useImageQuery()
->filterByPrimaryKeys($image->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByImage() only accepts arguments of type Image or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Image relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ContentQuery The current query, for fluid interface
*/
public function joinImage($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Image');
// 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, 'Image');
}
return $this;
}
/**
* Use the Image relation Image 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\ImageQuery A secondary query class using the current class as primary query
*/
public function useImageQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinImage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Image', '\Thelia\Model\ImageQuery');
}
/**
* Filter the query by a related Rewriting object
*
* @param Rewriting|PropelObjectCollection $rewriting the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByRewriting($rewriting, $comparison = null)
{
if ($rewriting instanceof Rewriting) {
return $this
->addUsingAlias(ContentPeer::ID, $rewriting->getContentId(), $comparison);
} elseif ($rewriting instanceof PropelObjectCollection) {
return $this
->useRewritingQuery()
->filterByPrimaryKeys($rewriting->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByRewriting() only accepts arguments of type Rewriting or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Rewriting relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ContentQuery The current query, for fluid interface
*/
public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Rewriting');
// 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, 'Rewriting');
}
return $this;
}
/**
* Use the Rewriting relation Rewriting 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\RewritingQuery A secondary query class using the current class as primary query
*/
public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinRewriting($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery');
}
/**
* Exclude object from result
*
* @param Content $content Object to remove from the list of results
*
* @return ContentQuery The current query, for fluid interface
*/
public function prune($content = null)
{
if ($content) {
$this->addUsingAlias(ContentPeer::ID, $content->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,613 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Country;
use Thelia\Model\CountryDesc;
use Thelia\Model\CountryDescPeer;
use Thelia\Model\CountryDescQuery;
/**
* Base class that represents a query for the 'country_desc' table.
*
*
*
* @method CountryDescQuery orderById($order = Criteria::ASC) Order by the id column
* @method CountryDescQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
* @method CountryDescQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method CountryDescQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method CountryDescQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method CountryDescQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method CountryDescQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method CountryDescQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method CountryDescQuery groupById() Group by the id column
* @method CountryDescQuery groupByCountryId() Group by the country_id column
* @method CountryDescQuery groupByLang() Group by the lang column
* @method CountryDescQuery groupByTitle() Group by the title column
* @method CountryDescQuery groupByDescription() Group by the description column
* @method CountryDescQuery groupByChapo() Group by the chapo column
* @method CountryDescQuery groupByCreatedAt() Group by the created_at column
* @method CountryDescQuery groupByUpdatedAt() Group by the updated_at column
*
* @method CountryDescQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CountryDescQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CountryDescQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CountryDescQuery leftJoinCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the Country relation
* @method CountryDescQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
* @method CountryDescQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
*
* @method CountryDesc findOne(PropelPDO $con = null) Return the first CountryDesc matching the query
* @method CountryDesc findOneOrCreate(PropelPDO $con = null) Return the first CountryDesc matching the query, or a new CountryDesc object populated from the query conditions when no match is found
*
* @method CountryDesc findOneById(int $id) Return the first CountryDesc filtered by the id column
* @method CountryDesc findOneByCountryId(int $country_id) Return the first CountryDesc filtered by the country_id column
* @method CountryDesc findOneByLang(string $lang) Return the first CountryDesc filtered by the lang column
* @method CountryDesc findOneByTitle(string $title) Return the first CountryDesc filtered by the title column
* @method CountryDesc findOneByDescription(string $description) Return the first CountryDesc filtered by the description column
* @method CountryDesc findOneByChapo(string $chapo) Return the first CountryDesc filtered by the chapo column
* @method CountryDesc findOneByCreatedAt(string $created_at) Return the first CountryDesc filtered by the created_at column
* @method CountryDesc findOneByUpdatedAt(string $updated_at) Return the first CountryDesc filtered by the updated_at column
*
* @method array findById(int $id) Return CountryDesc objects filtered by the id column
* @method array findByCountryId(int $country_id) Return CountryDesc objects filtered by the country_id column
* @method array findByLang(string $lang) Return CountryDesc objects filtered by the lang column
* @method array findByTitle(string $title) Return CountryDesc objects filtered by the title column
* @method array findByDescription(string $description) Return CountryDesc objects filtered by the description column
* @method array findByChapo(string $chapo) Return CountryDesc objects filtered by the chapo column
* @method array findByCreatedAt(string $created_at) Return CountryDesc objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return CountryDesc objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCountryDescQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCountryDescQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\CountryDesc', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CountryDescQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CountryDescQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CountryDescQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CountryDescQuery) {
return $criteria;
}
$query = new CountryDescQuery();
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 PropelPDO $con an optional connection object
*
* @return CountryDesc|CountryDesc[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CountryDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CountryDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CountryDesc A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `COUNTRY_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `country_desc` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CountryDesc();
$obj->hydrate($row);
CountryDescPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CountryDesc|CountryDesc[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|CountryDesc[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CountryDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CountryDescPeer::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 CountryDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CountryDescPeer::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 CountryDescQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CountryDescPeer::ID, $id, $comparison);
}
/**
* Filter the query on the country_id column
*
* Example usage:
* <code>
* $query->filterByCountryId(1234); // WHERE country_id = 1234
* $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
* $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
* </code>
*
* @see filterByCountry()
*
* @param mixed $countryId 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 CountryDescQuery The current query, for fluid interface
*/
public function filterByCountryId($countryId = null, $comparison = null)
{
if (is_array($countryId)) {
$useMinMax = false;
if (isset($countryId['min'])) {
$this->addUsingAlias(CountryDescPeer::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($countryId['max'])) {
$this->addUsingAlias(CountryDescPeer::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CountryDescPeer::COUNTRY_ID, $countryId, $comparison);
}
/**
* Filter the query on the lang column
*
* Example usage:
* <code>
* $query->filterByLang('fooValue'); // WHERE lang = 'fooValue'
* $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
* </code>
*
* @param string $lang 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 CountryDescQuery The current query, for fluid interface
*/
public function filterByLang($lang = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lang)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lang)) {
$lang = str_replace('*', '%', $lang);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CountryDescPeer::LANG, $lang, $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 CountryDescQuery 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(CountryDescPeer::TITLE, $title, $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 CountryDescQuery 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(CountryDescPeer::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo 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 CountryDescQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CountryDescPeer::CHAPO, $chapo, $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 CountryDescQuery 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(CountryDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CountryDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CountryDescPeer::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 CountryDescQuery 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(CountryDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CountryDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CountryDescPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Country object
*
* @param Country|PropelObjectCollection $country The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CountryDescQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCountry($country, $comparison = null)
{
if ($country instanceof Country) {
return $this
->addUsingAlias(CountryDescPeer::COUNTRY_ID, $country->getId(), $comparison);
} elseif ($country instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CountryDescPeer::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCountry() only accepts arguments of type Country or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Country relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CountryDescQuery The current query, for fluid interface
*/
public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Country');
// 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, 'Country');
}
return $this;
}
/**
* Use the Country relation Country 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\CountryQuery A secondary query class using the current class as primary query
*/
public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCountry($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Country', '\Thelia\Model\CountryQuery');
}
/**
* Exclude object from result
*
* @param CountryDesc $countryDesc Object to remove from the list of results
*
* @return CountryDescQuery The current query, for fluid interface
*/
public function prune($countryDesc = null)
{
if ($countryDesc) {
$this->addUsingAlias(CountryDescPeer::ID, $countryDesc->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,738 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Area;
use Thelia\Model\Country;
use Thelia\Model\CountryDesc;
use Thelia\Model\CountryPeer;
use Thelia\Model\CountryQuery;
use Thelia\Model\TaxRuleCountry;
/**
* Base class that represents a query for the 'country' table.
*
*
*
* @method CountryQuery orderById($order = Criteria::ASC) Order by the id column
* @method CountryQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
* @method CountryQuery orderByIsocode($order = Criteria::ASC) Order by the isocode column
* @method CountryQuery orderByIsoalpha2($order = Criteria::ASC) Order by the isoalpha2 column
* @method CountryQuery orderByIsoalpha3($order = Criteria::ASC) Order by the isoalpha3 column
* @method CountryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method CountryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method CountryQuery groupById() Group by the id column
* @method CountryQuery groupByAreaId() Group by the area_id column
* @method CountryQuery groupByIsocode() Group by the isocode column
* @method CountryQuery groupByIsoalpha2() Group by the isoalpha2 column
* @method CountryQuery groupByIsoalpha3() Group by the isoalpha3 column
* @method CountryQuery groupByCreatedAt() Group by the created_at column
* @method CountryQuery groupByUpdatedAt() Group by the updated_at column
*
* @method CountryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CountryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CountryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CountryQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method CountryQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method CountryQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
*
* @method CountryQuery leftJoinCountryDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the CountryDesc relation
* @method CountryQuery rightJoinCountryDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CountryDesc relation
* @method CountryQuery innerJoinCountryDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the CountryDesc relation
*
* @method CountryQuery leftJoinTaxRuleCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the TaxRuleCountry relation
* @method CountryQuery rightJoinTaxRuleCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRuleCountry relation
* @method CountryQuery innerJoinTaxRuleCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRuleCountry relation
*
* @method Country findOne(PropelPDO $con = null) Return the first Country matching the query
* @method Country findOneOrCreate(PropelPDO $con = null) Return the first Country matching the query, or a new Country object populated from the query conditions when no match is found
*
* @method Country findOneById(int $id) Return the first Country filtered by the id column
* @method Country findOneByAreaId(int $area_id) Return the first Country filtered by the area_id column
* @method Country findOneByIsocode(string $isocode) Return the first Country filtered by the isocode column
* @method Country findOneByIsoalpha2(string $isoalpha2) Return the first Country filtered by the isoalpha2 column
* @method Country findOneByIsoalpha3(string $isoalpha3) Return the first Country filtered by the isoalpha3 column
* @method Country findOneByCreatedAt(string $created_at) Return the first Country filtered by the created_at column
* @method Country findOneByUpdatedAt(string $updated_at) Return the first Country filtered by the updated_at column
*
* @method array findById(int $id) Return Country objects filtered by the id column
* @method array findByAreaId(int $area_id) Return Country objects filtered by the area_id column
* @method array findByIsocode(string $isocode) Return Country objects filtered by the isocode column
* @method array findByIsoalpha2(string $isoalpha2) Return Country objects filtered by the isoalpha2 column
* @method array findByIsoalpha3(string $isoalpha3) Return Country objects filtered by the isoalpha3 column
* @method array findByCreatedAt(string $created_at) Return Country objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Country objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCountryQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCountryQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Country', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CountryQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CountryQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CountryQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CountryQuery) {
return $criteria;
}
$query = new CountryQuery();
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 PropelPDO $con an optional connection object
*
* @return Country|Country[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CountryPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Country A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `AREA_ID`, `ISOCODE`, `ISOALPHA2`, `ISOALPHA3`, `CREATED_AT`, `UPDATED_AT` FROM `country` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Country();
$obj->hydrate($row);
CountryPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Country|Country[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Country[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CountryQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CountryPeer::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 CountryQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CountryPeer::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 CountryQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CountryPeer::ID, $id, $comparison);
}
/**
* Filter the query on the area_id column
*
* Example usage:
* <code>
* $query->filterByAreaId(1234); // WHERE area_id = 1234
* $query->filterByAreaId(array(12, 34)); // WHERE area_id IN (12, 34)
* $query->filterByAreaId(array('min' => 12)); // WHERE area_id > 12
* </code>
*
* @see filterByArea()
*
* @param mixed $areaId 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 CountryQuery The current query, for fluid interface
*/
public function filterByAreaId($areaId = null, $comparison = null)
{
if (is_array($areaId)) {
$useMinMax = false;
if (isset($areaId['min'])) {
$this->addUsingAlias(CountryPeer::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($areaId['max'])) {
$this->addUsingAlias(CountryPeer::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CountryPeer::AREA_ID, $areaId, $comparison);
}
/**
* Filter the query on the isocode column
*
* Example usage:
* <code>
* $query->filterByIsocode('fooValue'); // WHERE isocode = 'fooValue'
* $query->filterByIsocode('%fooValue%'); // WHERE isocode LIKE '%fooValue%'
* </code>
*
* @param string $isocode 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 CountryQuery The current query, for fluid interface
*/
public function filterByIsocode($isocode = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($isocode)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $isocode)) {
$isocode = str_replace('*', '%', $isocode);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CountryPeer::ISOCODE, $isocode, $comparison);
}
/**
* Filter the query on the isoalpha2 column
*
* Example usage:
* <code>
* $query->filterByIsoalpha2('fooValue'); // WHERE isoalpha2 = 'fooValue'
* $query->filterByIsoalpha2('%fooValue%'); // WHERE isoalpha2 LIKE '%fooValue%'
* </code>
*
* @param string $isoalpha2 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 CountryQuery The current query, for fluid interface
*/
public function filterByIsoalpha2($isoalpha2 = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($isoalpha2)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $isoalpha2)) {
$isoalpha2 = str_replace('*', '%', $isoalpha2);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CountryPeer::ISOALPHA2, $isoalpha2, $comparison);
}
/**
* Filter the query on the isoalpha3 column
*
* Example usage:
* <code>
* $query->filterByIsoalpha3('fooValue'); // WHERE isoalpha3 = 'fooValue'
* $query->filterByIsoalpha3('%fooValue%'); // WHERE isoalpha3 LIKE '%fooValue%'
* </code>
*
* @param string $isoalpha3 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 CountryQuery The current query, for fluid interface
*/
public function filterByIsoalpha3($isoalpha3 = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($isoalpha3)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $isoalpha3)) {
$isoalpha3 = str_replace('*', '%', $isoalpha3);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CountryPeer::ISOALPHA3, $isoalpha3, $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 CountryQuery 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(CountryPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CountryPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CountryPeer::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 CountryQuery 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(CountryPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CountryPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CountryPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Area object
*
* @param Area|PropelObjectCollection $area The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CountryQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByArea($area, $comparison = null)
{
if ($area instanceof Area) {
return $this
->addUsingAlias(CountryPeer::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CountryPeer::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByArea() only accepts arguments of type Area or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Area relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CountryQuery The current query, for fluid interface
*/
public function joinArea($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Area');
// 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, 'Area');
}
return $this;
}
/**
* Use the Area relation Area 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\AreaQuery A secondary query class using the current class as primary query
*/
public function useAreaQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinArea($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Area', '\Thelia\Model\AreaQuery');
}
/**
* Filter the query by a related CountryDesc object
*
* @param CountryDesc|PropelObjectCollection $countryDesc the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CountryQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCountryDesc($countryDesc, $comparison = null)
{
if ($countryDesc instanceof CountryDesc) {
return $this
->addUsingAlias(CountryPeer::ID, $countryDesc->getCountryId(), $comparison);
} elseif ($countryDesc instanceof PropelObjectCollection) {
return $this
->useCountryDescQuery()
->filterByPrimaryKeys($countryDesc->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCountryDesc() only accepts arguments of type CountryDesc or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the CountryDesc relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CountryQuery The current query, for fluid interface
*/
public function joinCountryDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CountryDesc');
// 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, 'CountryDesc');
}
return $this;
}
/**
* Use the CountryDesc relation CountryDesc 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\CountryDescQuery A secondary query class using the current class as primary query
*/
public function useCountryDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCountryDesc($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CountryDesc', '\Thelia\Model\CountryDescQuery');
}
/**
* Filter the query by a related TaxRuleCountry object
*
* @param TaxRuleCountry|PropelObjectCollection $taxRuleCountry the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CountryQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByTaxRuleCountry($taxRuleCountry, $comparison = null)
{
if ($taxRuleCountry instanceof TaxRuleCountry) {
return $this
->addUsingAlias(CountryPeer::ID, $taxRuleCountry->getCountryId(), $comparison);
} elseif ($taxRuleCountry instanceof PropelObjectCollection) {
return $this
->useTaxRuleCountryQuery()
->filterByPrimaryKeys($taxRuleCountry->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByTaxRuleCountry() only accepts arguments of type TaxRuleCountry or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the TaxRuleCountry relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CountryQuery The current query, for fluid interface
*/
public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('TaxRuleCountry');
// 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, 'TaxRuleCountry');
}
return $this;
}
/**
* Use the TaxRuleCountry relation TaxRuleCountry 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\TaxRuleCountryQuery A secondary query class using the current class as primary query
*/
public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinTaxRuleCountry($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'TaxRuleCountry', '\Thelia\Model\TaxRuleCountryQuery');
}
/**
* Exclude object from result
*
* @param Country $country Object to remove from the list of results
*
* @return CountryQuery The current query, for fluid interface
*/
public function prune($country = null)
{
if ($country) {
$this->addUsingAlias(CountryPeer::ID, $country->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,559 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\CouponOrder;
use Thelia\Model\CouponOrderPeer;
use Thelia\Model\CouponOrderQuery;
use Thelia\Model\Order;
/**
* Base class that represents a query for the 'coupon_order' table.
*
*
*
* @method CouponOrderQuery orderById($order = Criteria::ASC) Order by the id column
* @method CouponOrderQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
* @method CouponOrderQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method CouponOrderQuery orderByValue($order = Criteria::ASC) Order by the value column
* @method CouponOrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method CouponOrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method CouponOrderQuery groupById() Group by the id column
* @method CouponOrderQuery groupByOrderId() Group by the order_id column
* @method CouponOrderQuery groupByCode() Group by the code column
* @method CouponOrderQuery groupByValue() Group by the value column
* @method CouponOrderQuery groupByCreatedAt() Group by the created_at column
* @method CouponOrderQuery groupByUpdatedAt() Group by the updated_at column
*
* @method CouponOrderQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CouponOrderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CouponOrderQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CouponOrderQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
* @method CouponOrderQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
* @method CouponOrderQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
*
* @method CouponOrder findOne(PropelPDO $con = null) Return the first CouponOrder matching the query
* @method CouponOrder findOneOrCreate(PropelPDO $con = null) Return the first CouponOrder matching the query, or a new CouponOrder object populated from the query conditions when no match is found
*
* @method CouponOrder findOneById(int $id) Return the first CouponOrder filtered by the id column
* @method CouponOrder findOneByOrderId(int $order_id) Return the first CouponOrder filtered by the order_id column
* @method CouponOrder findOneByCode(string $code) Return the first CouponOrder filtered by the code column
* @method CouponOrder findOneByValue(double $value) Return the first CouponOrder filtered by the value column
* @method CouponOrder findOneByCreatedAt(string $created_at) Return the first CouponOrder filtered by the created_at column
* @method CouponOrder findOneByUpdatedAt(string $updated_at) Return the first CouponOrder filtered by the updated_at column
*
* @method array findById(int $id) Return CouponOrder objects filtered by the id column
* @method array findByOrderId(int $order_id) Return CouponOrder objects filtered by the order_id column
* @method array findByCode(string $code) Return CouponOrder objects filtered by the code column
* @method array findByValue(double $value) Return CouponOrder objects filtered by the value column
* @method array findByCreatedAt(string $created_at) Return CouponOrder objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return CouponOrder objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCouponOrderQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCouponOrderQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\CouponOrder', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CouponOrderQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CouponOrderQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CouponOrderQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CouponOrderQuery) {
return $criteria;
}
$query = new CouponOrderQuery();
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 PropelPDO $con an optional connection object
*
* @return CouponOrder|CouponOrder[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CouponOrderPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CouponOrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CouponOrder A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `ORDER_ID`, `CODE`, `VALUE`, `CREATED_AT`, `UPDATED_AT` FROM `coupon_order` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CouponOrder();
$obj->hydrate($row);
CouponOrderPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CouponOrder|CouponOrder[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|CouponOrder[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CouponOrderQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CouponOrderPeer::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 CouponOrderQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CouponOrderPeer::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 CouponOrderQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CouponOrderPeer::ID, $id, $comparison);
}
/**
* Filter the query on the order_id column
*
* Example usage:
* <code>
* $query->filterByOrderId(1234); // WHERE order_id = 1234
* $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34)
* $query->filterByOrderId(array('min' => 12)); // WHERE order_id > 12
* </code>
*
* @see filterByOrder()
*
* @param mixed $orderId 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 CouponOrderQuery The current query, for fluid interface
*/
public function filterByOrderId($orderId = null, $comparison = null)
{
if (is_array($orderId)) {
$useMinMax = false;
if (isset($orderId['min'])) {
$this->addUsingAlias(CouponOrderPeer::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($orderId['max'])) {
$this->addUsingAlias(CouponOrderPeer::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderPeer::ORDER_ID, $orderId, $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 CouponOrderQuery 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(CouponOrderPeer::CODE, $code, $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 CouponOrderQuery 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(CouponOrderPeer::VALUE, $value['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($value['max'])) {
$this->addUsingAlias(CouponOrderPeer::VALUE, $value['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderPeer::VALUE, $value, $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 CouponOrderQuery 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(CouponOrderPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CouponOrderPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderPeer::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 CouponOrderQuery 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(CouponOrderPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CouponOrderPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Order object
*
* @param Order|PropelObjectCollection $order The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CouponOrderQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByOrder($order, $comparison = null)
{
if ($order instanceof Order) {
return $this
->addUsingAlias(CouponOrderPeer::ORDER_ID, $order->getId(), $comparison);
} elseif ($order instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CouponOrderPeer::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByOrder() only accepts arguments of type Order or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Order relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CouponOrderQuery The current query, for fluid interface
*/
public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Order');
// 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, 'Order');
}
return $this;
}
/**
* Use the Order relation Order 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\OrderQuery A secondary query class using the current class as primary query
*/
public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
}
/**
* Exclude object from result
*
* @param CouponOrder $couponOrder Object to remove from the list of results
*
* @return CouponOrderQuery The current query, for fluid interface
*/
public function prune($couponOrder = null)
{
if ($couponOrder) {
$this->addUsingAlias(CouponOrderPeer::ID, $couponOrder->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

View File

@@ -0,0 +1,812 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\Coupon;
use Thelia\Model\CouponPeer;
use Thelia\Model\CouponRulePeer;
use Thelia\Model\map\CouponTableMap;
/**
* Base static class for performing query and update operations on the 'coupon' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCouponPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'coupon';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\Coupon';
/** the related TableMap class for this table */
const TM_CLASS = 'CouponTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 10;
/** 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 = 10;
/** the column name for the ID field */
const ID = 'coupon.ID';
/** the column name for the CODE field */
const CODE = 'coupon.CODE';
/** the column name for the ACTION field */
const ACTION = 'coupon.ACTION';
/** the column name for the VALUE field */
const VALUE = 'coupon.VALUE';
/** the column name for the USED field */
const USED = 'coupon.USED';
/** the column name for the AVAILABLE_SINCE field */
const AVAILABLE_SINCE = 'coupon.AVAILABLE_SINCE';
/** the column name for the DATE_LIMIT field */
const DATE_LIMIT = 'coupon.DATE_LIMIT';
/** the column name for the ACTIVATE field */
const ACTIVATE = 'coupon.ACTIVATE';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'coupon.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'coupon.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of Coupon objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array Coupon[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. CouponPeer::$fieldNames[CouponPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Code', 'Action', 'Value', 'Used', 'AvailableSince', 'DateLimit', 'Activate', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'code', 'action', 'value', 'used', 'availableSince', 'dateLimit', 'activate', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (CouponPeer::ID, CouponPeer::CODE, CouponPeer::ACTION, CouponPeer::VALUE, CouponPeer::USED, CouponPeer::AVAILABLE_SINCE, CouponPeer::DATE_LIMIT, CouponPeer::ACTIVATE, CouponPeer::CREATED_AT, CouponPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'ACTION', 'VALUE', 'USED', 'AVAILABLE_SINCE', 'DATE_LIMIT', 'ACTIVATE', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'action', 'value', 'used', 'available_since', 'date_limit', 'activate', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. CouponPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Code' => 1, 'Action' => 2, 'Value' => 3, 'Used' => 4, 'AvailableSince' => 5, 'DateLimit' => 6, 'Activate' => 7, 'CreatedAt' => 8, 'UpdatedAt' => 9, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'code' => 1, 'action' => 2, 'value' => 3, 'used' => 4, 'availableSince' => 5, 'dateLimit' => 6, 'activate' => 7, 'createdAt' => 8, 'updatedAt' => 9, ),
BasePeer::TYPE_COLNAME => array (CouponPeer::ID => 0, CouponPeer::CODE => 1, CouponPeer::ACTION => 2, CouponPeer::VALUE => 3, CouponPeer::USED => 4, CouponPeer::AVAILABLE_SINCE => 5, CouponPeer::DATE_LIMIT => 6, CouponPeer::ACTIVATE => 7, CouponPeer::CREATED_AT => 8, CouponPeer::UPDATED_AT => 9, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'ACTION' => 2, 'VALUE' => 3, 'USED' => 4, 'AVAILABLE_SINCE' => 5, 'DATE_LIMIT' => 6, 'ACTIVATE' => 7, 'CREATED_AT' => 8, 'UPDATED_AT' => 9, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'action' => 2, 'value' => 3, 'used' => 4, 'available_since' => 5, 'date_limit' => 6, 'activate' => 7, 'created_at' => 8, 'updated_at' => 9, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = CouponPeer::getFieldNames($toType);
$key = isset(CouponPeer::$fieldKeys[$fromType][$name]) ? CouponPeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CouponPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, CouponPeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return CouponPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CouponPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CouponPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(CouponPeer::ID);
$criteria->addSelectColumn(CouponPeer::CODE);
$criteria->addSelectColumn(CouponPeer::ACTION);
$criteria->addSelectColumn(CouponPeer::VALUE);
$criteria->addSelectColumn(CouponPeer::USED);
$criteria->addSelectColumn(CouponPeer::AVAILABLE_SINCE);
$criteria->addSelectColumn(CouponPeer::DATE_LIMIT);
$criteria->addSelectColumn(CouponPeer::ACTIVATE);
$criteria->addSelectColumn(CouponPeer::CREATED_AT);
$criteria->addSelectColumn(CouponPeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CODE');
$criteria->addSelectColumn($alias . '.ACTION');
$criteria->addSelectColumn($alias . '.VALUE');
$criteria->addSelectColumn($alias . '.USED');
$criteria->addSelectColumn($alias . '.AVAILABLE_SINCE');
$criteria->addSelectColumn($alias . '.DATE_LIMIT');
$criteria->addSelectColumn($alias . '.ACTIVATE');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CouponPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CouponPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(CouponPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CouponPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return Coupon
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = CouponPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return CouponPeer::populateObjects(CouponPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CouponPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CouponPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(CouponPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Coupon $obj A Coupon object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
CouponPeer::$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 Coupon object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof Coupon) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Coupon object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(CouponPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return Coupon Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(CouponPeer::$instances[$key])) {
return CouponPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
CouponPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to coupon
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in CouponRulePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CouponRulePeer::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = CouponPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CouponPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CouponPeer::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;
CouponPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (Coupon object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CouponPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CouponPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CouponPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CouponPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CouponPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(CouponPeer::DATABASE_NAME)->getTable(CouponPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCouponPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCouponPeer::TABLE_NAME)) {
$dbMap->addTableObject(new CouponTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return CouponPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a Coupon or Criteria object.
*
* @param mixed $values Criteria or Coupon object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CouponPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Coupon object
}
if ($criteria->containsKey(CouponPeer::ID) && $criteria->keyContainsValue(CouponPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CouponPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(CouponPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a Coupon or Criteria object.
*
* @param mixed $values Criteria or Coupon object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CouponPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(CouponPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CouponPeer::ID);
$value = $criteria->remove(CouponPeer::ID);
if ($value) {
$selectCriteria->add(CouponPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CouponPeer::TABLE_NAME);
}
} else { // $values is Coupon object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(CouponPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the coupon table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CouponPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(CouponPeer::TABLE_NAME, $con, CouponPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CouponPeer::clearInstancePool();
CouponPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a Coupon or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Coupon object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CouponPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
CouponPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof Coupon) { // it's a model object
// invalidate the cache for this single object
CouponPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(CouponPeer::DATABASE_NAME);
$criteria->add(CouponPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CouponPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(CouponPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
CouponPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given Coupon object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param Coupon $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CouponPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CouponPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(CouponPeer::DATABASE_NAME, CouponPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return Coupon
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CouponPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CouponPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CouponPeer::DATABASE_NAME);
$criteria->add(CouponPeer::ID, $pk);
$v = CouponPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return Coupon[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CouponPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CouponPeer::DATABASE_NAME);
$criteria->add(CouponPeer::ID, $pks, Criteria::IN);
$objs = CouponPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCouponPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCouponPeer::buildTableMap();

View File

@@ -0,0 +1,727 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Coupon;
use Thelia\Model\CouponPeer;
use Thelia\Model\CouponQuery;
use Thelia\Model\CouponRule;
/**
* Base class that represents a query for the 'coupon' table.
*
*
*
* @method CouponQuery orderById($order = Criteria::ASC) Order by the id column
* @method CouponQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method CouponQuery orderByAction($order = Criteria::ASC) Order by the action column
* @method CouponQuery orderByValue($order = Criteria::ASC) Order by the value column
* @method CouponQuery orderByUsed($order = Criteria::ASC) Order by the used column
* @method CouponQuery orderByAvailableSince($order = Criteria::ASC) Order by the available_since column
* @method CouponQuery orderByDateLimit($order = Criteria::ASC) Order by the date_limit column
* @method CouponQuery orderByActivate($order = Criteria::ASC) Order by the activate column
* @method CouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method CouponQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method CouponQuery groupById() Group by the id column
* @method CouponQuery groupByCode() Group by the code column
* @method CouponQuery groupByAction() Group by the action column
* @method CouponQuery groupByValue() Group by the value column
* @method CouponQuery groupByUsed() Group by the used column
* @method CouponQuery groupByAvailableSince() Group by the available_since column
* @method CouponQuery groupByDateLimit() Group by the date_limit column
* @method CouponQuery groupByActivate() Group by the activate column
* @method CouponQuery groupByCreatedAt() Group by the created_at column
* @method CouponQuery groupByUpdatedAt() Group by the updated_at column
*
* @method CouponQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CouponQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CouponQuery leftJoinCouponRule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponRule relation
* @method CouponQuery rightJoinCouponRule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponRule relation
* @method CouponQuery innerJoinCouponRule($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponRule relation
*
* @method Coupon findOne(PropelPDO $con = null) Return the first Coupon matching the query
* @method Coupon findOneOrCreate(PropelPDO $con = null) Return the first Coupon matching the query, or a new Coupon object populated from the query conditions when no match is found
*
* @method Coupon findOneById(int $id) Return the first Coupon filtered by the id column
* @method Coupon findOneByCode(string $code) Return the first Coupon filtered by the code column
* @method Coupon findOneByAction(string $action) Return the first Coupon filtered by the action column
* @method Coupon findOneByValue(double $value) Return the first Coupon filtered by the value column
* @method Coupon findOneByUsed(int $used) Return the first Coupon filtered by the used column
* @method Coupon findOneByAvailableSince(string $available_since) Return the first Coupon filtered by the available_since column
* @method Coupon findOneByDateLimit(string $date_limit) Return the first Coupon filtered by the date_limit column
* @method Coupon findOneByActivate(int $activate) Return the first Coupon filtered by the activate column
* @method Coupon findOneByCreatedAt(string $created_at) Return the first Coupon filtered by the created_at column
* @method Coupon findOneByUpdatedAt(string $updated_at) Return the first Coupon filtered by the updated_at column
*
* @method array findById(int $id) Return Coupon objects filtered by the id column
* @method array findByCode(string $code) Return Coupon objects filtered by the code column
* @method array findByAction(string $action) Return Coupon objects filtered by the action column
* @method array findByValue(double $value) Return Coupon objects filtered by the value column
* @method array findByUsed(int $used) Return Coupon objects filtered by the used column
* @method array findByAvailableSince(string $available_since) Return Coupon objects filtered by the available_since column
* @method array findByDateLimit(string $date_limit) Return Coupon objects filtered by the date_limit column
* @method array findByActivate(int $activate) Return Coupon objects filtered by the activate column
* @method array findByCreatedAt(string $created_at) Return Coupon objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Coupon objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCouponQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCouponQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Coupon', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CouponQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CouponQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CouponQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CouponQuery) {
return $criteria;
}
$query = new CouponQuery();
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 PropelPDO $con an optional connection object
*
* @return Coupon|Coupon[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CouponPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CouponPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Coupon A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `CODE`, `ACTION`, `VALUE`, `USED`, `AVAILABLE_SINCE`, `DATE_LIMIT`, `ACTIVATE`, `CREATED_AT`, `UPDATED_AT` FROM `coupon` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Coupon();
$obj->hydrate($row);
CouponPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Coupon|Coupon[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Coupon[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CouponQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CouponPeer::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 CouponQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CouponPeer::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 CouponQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CouponPeer::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 CouponQuery 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(CouponPeer::CODE, $code, $comparison);
}
/**
* Filter the query on the action column
*
* Example usage:
* <code>
* $query->filterByAction('fooValue'); // WHERE action = 'fooValue'
* $query->filterByAction('%fooValue%'); // WHERE action LIKE '%fooValue%'
* </code>
*
* @param string $action 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 CouponQuery The current query, for fluid interface
*/
public function filterByAction($action = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($action)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $action)) {
$action = str_replace('*', '%', $action);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponPeer::ACTION, $action, $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 CouponQuery 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(CouponPeer::VALUE, $value['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($value['max'])) {
$this->addUsingAlias(CouponPeer::VALUE, $value['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponPeer::VALUE, $value, $comparison);
}
/**
* Filter the query on the used column
*
* Example usage:
* <code>
* $query->filterByUsed(1234); // WHERE used = 1234
* $query->filterByUsed(array(12, 34)); // WHERE used IN (12, 34)
* $query->filterByUsed(array('min' => 12)); // WHERE used > 12
* </code>
*
* @param mixed $used 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 CouponQuery The current query, for fluid interface
*/
public function filterByUsed($used = null, $comparison = null)
{
if (is_array($used)) {
$useMinMax = false;
if (isset($used['min'])) {
$this->addUsingAlias(CouponPeer::USED, $used['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($used['max'])) {
$this->addUsingAlias(CouponPeer::USED, $used['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponPeer::USED, $used, $comparison);
}
/**
* Filter the query on the available_since column
*
* Example usage:
* <code>
* $query->filterByAvailableSince('2011-03-14'); // WHERE available_since = '2011-03-14'
* $query->filterByAvailableSince('now'); // WHERE available_since = '2011-03-14'
* $query->filterByAvailableSince(array('max' => 'yesterday')); // WHERE available_since > '2011-03-13'
* </code>
*
* @param mixed $availableSince 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 CouponQuery The current query, for fluid interface
*/
public function filterByAvailableSince($availableSince = null, $comparison = null)
{
if (is_array($availableSince)) {
$useMinMax = false;
if (isset($availableSince['min'])) {
$this->addUsingAlias(CouponPeer::AVAILABLE_SINCE, $availableSince['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($availableSince['max'])) {
$this->addUsingAlias(CouponPeer::AVAILABLE_SINCE, $availableSince['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponPeer::AVAILABLE_SINCE, $availableSince, $comparison);
}
/**
* Filter the query on the date_limit column
*
* Example usage:
* <code>
* $query->filterByDateLimit('2011-03-14'); // WHERE date_limit = '2011-03-14'
* $query->filterByDateLimit('now'); // WHERE date_limit = '2011-03-14'
* $query->filterByDateLimit(array('max' => 'yesterday')); // WHERE date_limit > '2011-03-13'
* </code>
*
* @param mixed $dateLimit 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 CouponQuery The current query, for fluid interface
*/
public function filterByDateLimit($dateLimit = null, $comparison = null)
{
if (is_array($dateLimit)) {
$useMinMax = false;
if (isset($dateLimit['min'])) {
$this->addUsingAlias(CouponPeer::DATE_LIMIT, $dateLimit['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dateLimit['max'])) {
$this->addUsingAlias(CouponPeer::DATE_LIMIT, $dateLimit['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponPeer::DATE_LIMIT, $dateLimit, $comparison);
}
/**
* Filter the query on the activate column
*
* Example usage:
* <code>
* $query->filterByActivate(1234); // WHERE activate = 1234
* $query->filterByActivate(array(12, 34)); // WHERE activate IN (12, 34)
* $query->filterByActivate(array('min' => 12)); // WHERE activate > 12
* </code>
*
* @param mixed $activate 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 CouponQuery The current query, for fluid interface
*/
public function filterByActivate($activate = null, $comparison = null)
{
if (is_array($activate)) {
$useMinMax = false;
if (isset($activate['min'])) {
$this->addUsingAlias(CouponPeer::ACTIVATE, $activate['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($activate['max'])) {
$this->addUsingAlias(CouponPeer::ACTIVATE, $activate['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponPeer::ACTIVATE, $activate, $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 CouponQuery 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(CouponPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CouponPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponPeer::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 CouponQuery 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(CouponPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CouponPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related CouponRule object
*
* @param CouponRule|PropelObjectCollection $couponRule the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CouponQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCouponRule($couponRule, $comparison = null)
{
if ($couponRule instanceof CouponRule) {
return $this
->addUsingAlias(CouponPeer::ID, $couponRule->getCouponId(), $comparison);
} elseif ($couponRule instanceof PropelObjectCollection) {
return $this
->useCouponRuleQuery()
->filterByPrimaryKeys($couponRule->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCouponRule() only accepts arguments of type CouponRule or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the CouponRule relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CouponQuery The current query, for fluid interface
*/
public function joinCouponRule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CouponRule');
// 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, 'CouponRule');
}
return $this;
}
/**
* Use the CouponRule relation CouponRule 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\CouponRuleQuery A secondary query class using the current class as primary query
*/
public function useCouponRuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCouponRule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CouponRule', '\Thelia\Model\CouponRuleQuery');
}
/**
* Exclude object from result
*
* @param Coupon $coupon Object to remove from the list of results
*
* @return CouponQuery The current query, for fluid interface
*/
public function prune($coupon = null)
{
if ($coupon) {
$this->addUsingAlias(CouponPeer::ID, $coupon->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,592 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Coupon;
use Thelia\Model\CouponRule;
use Thelia\Model\CouponRulePeer;
use Thelia\Model\CouponRuleQuery;
/**
* Base class that represents a query for the 'coupon_rule' table.
*
*
*
* @method CouponRuleQuery orderById($order = Criteria::ASC) Order by the id column
* @method CouponRuleQuery orderByCouponId($order = Criteria::ASC) Order by the coupon_id column
* @method CouponRuleQuery orderByController($order = Criteria::ASC) Order by the controller column
* @method CouponRuleQuery orderByOperation($order = Criteria::ASC) Order by the operation column
* @method CouponRuleQuery orderByValue($order = Criteria::ASC) Order by the value column
* @method CouponRuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method CouponRuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method CouponRuleQuery groupById() Group by the id column
* @method CouponRuleQuery groupByCouponId() Group by the coupon_id column
* @method CouponRuleQuery groupByController() Group by the controller column
* @method CouponRuleQuery groupByOperation() Group by the operation column
* @method CouponRuleQuery groupByValue() Group by the value column
* @method CouponRuleQuery groupByCreatedAt() Group by the created_at column
* @method CouponRuleQuery groupByUpdatedAt() Group by the updated_at column
*
* @method CouponRuleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CouponRuleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CouponRuleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CouponRuleQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
* @method CouponRuleQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
* @method CouponRuleQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
*
* @method CouponRule findOne(PropelPDO $con = null) Return the first CouponRule matching the query
* @method CouponRule findOneOrCreate(PropelPDO $con = null) Return the first CouponRule matching the query, or a new CouponRule object populated from the query conditions when no match is found
*
* @method CouponRule findOneById(int $id) Return the first CouponRule filtered by the id column
* @method CouponRule findOneByCouponId(int $coupon_id) Return the first CouponRule filtered by the coupon_id column
* @method CouponRule findOneByController(string $controller) Return the first CouponRule filtered by the controller column
* @method CouponRule findOneByOperation(string $operation) Return the first CouponRule filtered by the operation column
* @method CouponRule findOneByValue(double $value) Return the first CouponRule filtered by the value column
* @method CouponRule findOneByCreatedAt(string $created_at) Return the first CouponRule filtered by the created_at column
* @method CouponRule findOneByUpdatedAt(string $updated_at) Return the first CouponRule filtered by the updated_at column
*
* @method array findById(int $id) Return CouponRule objects filtered by the id column
* @method array findByCouponId(int $coupon_id) Return CouponRule objects filtered by the coupon_id column
* @method array findByController(string $controller) Return CouponRule objects filtered by the controller column
* @method array findByOperation(string $operation) Return CouponRule objects filtered by the operation column
* @method array findByValue(double $value) Return CouponRule objects filtered by the value column
* @method array findByCreatedAt(string $created_at) Return CouponRule objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return CouponRule objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCouponRuleQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCouponRuleQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\CouponRule', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CouponRuleQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CouponRuleQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CouponRuleQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CouponRuleQuery) {
return $criteria;
}
$query = new CouponRuleQuery();
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 PropelPDO $con an optional connection object
*
* @return CouponRule|CouponRule[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CouponRulePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CouponRulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CouponRule A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `COUPON_ID`, `CONTROLLER`, `OPERATION`, `VALUE`, `CREATED_AT`, `UPDATED_AT` FROM `coupon_rule` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CouponRule();
$obj->hydrate($row);
CouponRulePeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CouponRule|CouponRule[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|CouponRule[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CouponRuleQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CouponRulePeer::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 CouponRuleQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CouponRulePeer::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 CouponRuleQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CouponRulePeer::ID, $id, $comparison);
}
/**
* Filter the query on the coupon_id column
*
* Example usage:
* <code>
* $query->filterByCouponId(1234); // WHERE coupon_id = 1234
* $query->filterByCouponId(array(12, 34)); // WHERE coupon_id IN (12, 34)
* $query->filterByCouponId(array('min' => 12)); // WHERE coupon_id > 12
* </code>
*
* @see filterByCoupon()
*
* @param mixed $couponId 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 CouponRuleQuery The current query, for fluid interface
*/
public function filterByCouponId($couponId = null, $comparison = null)
{
if (is_array($couponId)) {
$useMinMax = false;
if (isset($couponId['min'])) {
$this->addUsingAlias(CouponRulePeer::COUPON_ID, $couponId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($couponId['max'])) {
$this->addUsingAlias(CouponRulePeer::COUPON_ID, $couponId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponRulePeer::COUPON_ID, $couponId, $comparison);
}
/**
* Filter the query on the controller column
*
* Example usage:
* <code>
* $query->filterByController('fooValue'); // WHERE controller = 'fooValue'
* $query->filterByController('%fooValue%'); // WHERE controller LIKE '%fooValue%'
* </code>
*
* @param string $controller 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 CouponRuleQuery The current query, for fluid interface
*/
public function filterByController($controller = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($controller)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $controller)) {
$controller = str_replace('*', '%', $controller);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponRulePeer::CONTROLLER, $controller, $comparison);
}
/**
* Filter the query on the operation column
*
* Example usage:
* <code>
* $query->filterByOperation('fooValue'); // WHERE operation = 'fooValue'
* $query->filterByOperation('%fooValue%'); // WHERE operation LIKE '%fooValue%'
* </code>
*
* @param string $operation 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 CouponRuleQuery The current query, for fluid interface
*/
public function filterByOperation($operation = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($operation)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $operation)) {
$operation = str_replace('*', '%', $operation);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponRulePeer::OPERATION, $operation, $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 CouponRuleQuery 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(CouponRulePeer::VALUE, $value['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($value['max'])) {
$this->addUsingAlias(CouponRulePeer::VALUE, $value['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponRulePeer::VALUE, $value, $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 CouponRuleQuery 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(CouponRulePeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CouponRulePeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponRulePeer::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 CouponRuleQuery 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(CouponRulePeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CouponRulePeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponRulePeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Coupon object
*
* @param Coupon|PropelObjectCollection $coupon The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CouponRuleQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCoupon($coupon, $comparison = null)
{
if ($coupon instanceof Coupon) {
return $this
->addUsingAlias(CouponRulePeer::COUPON_ID, $coupon->getId(), $comparison);
} elseif ($coupon instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CouponRulePeer::COUPON_ID, $coupon->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCoupon() only accepts arguments of type Coupon or PropelCollection');
}
}
/**
* 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 CouponRuleQuery 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 CouponRule $couponRule Object to remove from the list of results
*
* @return CouponRuleQuery The current query, for fluid interface
*/
public function prune($couponRule = null)
{
if ($couponRule) {
$this->addUsingAlias(CouponRulePeer::ID, $couponRule->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,802 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\Currency;
use Thelia\Model\CurrencyPeer;
use Thelia\Model\OrderPeer;
use Thelia\Model\map\CurrencyTableMap;
/**
* Base static class for performing query and update operations on the 'currency' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCurrencyPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'currency';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\Currency';
/** the related TableMap class for this table */
const TM_CLASS = 'CurrencyTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 8;
/** 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 = 8;
/** the column name for the ID field */
const ID = 'currency.ID';
/** the column name for the NAME field */
const NAME = 'currency.NAME';
/** the column name for the CODE field */
const CODE = 'currency.CODE';
/** the column name for the SYMBOL field */
const SYMBOL = 'currency.SYMBOL';
/** the column name for the RATE field */
const RATE = 'currency.RATE';
/** the column name for the DEFAULT_UTILITY field */
const DEFAULT_UTILITY = 'currency.DEFAULT_UTILITY';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'currency.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'currency.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of Currency objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array Currency[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. CurrencyPeer::$fieldNames[CurrencyPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Name', 'Code', 'Symbol', 'Rate', 'DefaultUtility', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'name', 'code', 'symbol', 'rate', 'defaultUtility', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (CurrencyPeer::ID, CurrencyPeer::NAME, CurrencyPeer::CODE, CurrencyPeer::SYMBOL, CurrencyPeer::RATE, CurrencyPeer::DEFAULT_UTILITY, CurrencyPeer::CREATED_AT, CurrencyPeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'CODE', 'SYMBOL', 'RATE', 'DEFAULT_UTILITY', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'code', 'symbol', 'rate', 'default_utility', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. CurrencyPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'Code' => 2, 'Symbol' => 3, 'Rate' => 4, 'DefaultUtility' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'name' => 1, 'code' => 2, 'symbol' => 3, 'rate' => 4, 'defaultUtility' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
BasePeer::TYPE_COLNAME => array (CurrencyPeer::ID => 0, CurrencyPeer::NAME => 1, CurrencyPeer::CODE => 2, CurrencyPeer::SYMBOL => 3, CurrencyPeer::RATE => 4, CurrencyPeer::DEFAULT_UTILITY => 5, CurrencyPeer::CREATED_AT => 6, CurrencyPeer::UPDATED_AT => 7, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'CODE' => 2, 'SYMBOL' => 3, 'RATE' => 4, 'DEFAULT_UTILITY' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'code' => 2, 'symbol' => 3, 'rate' => 4, 'default_utility' => 5, 'created_at' => 6, 'updated_at' => 7, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = CurrencyPeer::getFieldNames($toType);
$key = isset(CurrencyPeer::$fieldKeys[$fromType][$name]) ? CurrencyPeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CurrencyPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, CurrencyPeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return CurrencyPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CurrencyPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CurrencyPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(CurrencyPeer::ID);
$criteria->addSelectColumn(CurrencyPeer::NAME);
$criteria->addSelectColumn(CurrencyPeer::CODE);
$criteria->addSelectColumn(CurrencyPeer::SYMBOL);
$criteria->addSelectColumn(CurrencyPeer::RATE);
$criteria->addSelectColumn(CurrencyPeer::DEFAULT_UTILITY);
$criteria->addSelectColumn(CurrencyPeer::CREATED_AT);
$criteria->addSelectColumn(CurrencyPeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.CODE');
$criteria->addSelectColumn($alias . '.SYMBOL');
$criteria->addSelectColumn($alias . '.RATE');
$criteria->addSelectColumn($alias . '.DEFAULT_UTILITY');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CurrencyPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CurrencyPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(CurrencyPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CurrencyPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return Currency
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = CurrencyPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return CurrencyPeer::populateObjects(CurrencyPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CurrencyPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CurrencyPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(CurrencyPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Currency $obj A Currency object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
CurrencyPeer::$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 Currency object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof Currency) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Currency object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(CurrencyPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return Currency Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(CurrencyPeer::$instances[$key])) {
return CurrencyPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
CurrencyPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to currency
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in OrderPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
OrderPeer::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = CurrencyPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CurrencyPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CurrencyPeer::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;
CurrencyPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (Currency object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CurrencyPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CurrencyPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CurrencyPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CurrencyPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CurrencyPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(CurrencyPeer::DATABASE_NAME)->getTable(CurrencyPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCurrencyPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCurrencyPeer::TABLE_NAME)) {
$dbMap->addTableObject(new CurrencyTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return CurrencyPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a Currency or Criteria object.
*
* @param mixed $values Criteria or Currency object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CurrencyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Currency object
}
if ($criteria->containsKey(CurrencyPeer::ID) && $criteria->keyContainsValue(CurrencyPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CurrencyPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(CurrencyPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a Currency or Criteria object.
*
* @param mixed $values Criteria or Currency object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CurrencyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(CurrencyPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CurrencyPeer::ID);
$value = $criteria->remove(CurrencyPeer::ID);
if ($value) {
$selectCriteria->add(CurrencyPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CurrencyPeer::TABLE_NAME);
}
} else { // $values is Currency object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(CurrencyPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the currency table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CurrencyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(CurrencyPeer::TABLE_NAME, $con, CurrencyPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CurrencyPeer::clearInstancePool();
CurrencyPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a Currency or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Currency object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CurrencyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
CurrencyPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof Currency) { // it's a model object
// invalidate the cache for this single object
CurrencyPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(CurrencyPeer::DATABASE_NAME);
$criteria->add(CurrencyPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CurrencyPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(CurrencyPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
CurrencyPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given Currency object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param Currency $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CurrencyPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CurrencyPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(CurrencyPeer::DATABASE_NAME, CurrencyPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return Currency
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CurrencyPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CurrencyPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CurrencyPeer::DATABASE_NAME);
$criteria->add(CurrencyPeer::ID, $pk);
$v = CurrencyPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return Currency[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CurrencyPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CurrencyPeer::DATABASE_NAME);
$criteria->add(CurrencyPeer::ID, $pks, Criteria::IN);
$objs = CurrencyPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCurrencyPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCurrencyPeer::buildTableMap();

View File

@@ -0,0 +1,621 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Currency;
use Thelia\Model\CurrencyPeer;
use Thelia\Model\CurrencyQuery;
use Thelia\Model\Order;
/**
* Base class that represents a query for the 'currency' table.
*
*
*
* @method CurrencyQuery orderById($order = Criteria::ASC) Order by the id column
* @method CurrencyQuery orderByName($order = Criteria::ASC) Order by the name column
* @method CurrencyQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method CurrencyQuery orderBySymbol($order = Criteria::ASC) Order by the symbol column
* @method CurrencyQuery orderByRate($order = Criteria::ASC) Order by the rate column
* @method CurrencyQuery orderByDefaultUtility($order = Criteria::ASC) Order by the default_utility column
* @method CurrencyQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method CurrencyQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method CurrencyQuery groupById() Group by the id column
* @method CurrencyQuery groupByName() Group by the name column
* @method CurrencyQuery groupByCode() Group by the code column
* @method CurrencyQuery groupBySymbol() Group by the symbol column
* @method CurrencyQuery groupByRate() Group by the rate column
* @method CurrencyQuery groupByDefaultUtility() Group by the default_utility column
* @method CurrencyQuery groupByCreatedAt() Group by the created_at column
* @method CurrencyQuery groupByUpdatedAt() Group by the updated_at column
*
* @method CurrencyQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CurrencyQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CurrencyQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CurrencyQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
* @method CurrencyQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
* @method CurrencyQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
*
* @method Currency findOne(PropelPDO $con = null) Return the first Currency matching the query
* @method Currency findOneOrCreate(PropelPDO $con = null) Return the first Currency matching the query, or a new Currency object populated from the query conditions when no match is found
*
* @method Currency findOneById(int $id) Return the first Currency filtered by the id column
* @method Currency findOneByName(string $name) Return the first Currency filtered by the name column
* @method Currency findOneByCode(string $code) Return the first Currency filtered by the code column
* @method Currency findOneBySymbol(string $symbol) Return the first Currency filtered by the symbol column
* @method Currency findOneByRate(double $rate) Return the first Currency filtered by the rate column
* @method Currency findOneByDefaultUtility(int $default_utility) Return the first Currency filtered by the default_utility column
* @method Currency findOneByCreatedAt(string $created_at) Return the first Currency filtered by the created_at column
* @method Currency findOneByUpdatedAt(string $updated_at) Return the first Currency filtered by the updated_at column
*
* @method array findById(int $id) Return Currency objects filtered by the id column
* @method array findByName(string $name) Return Currency objects filtered by the name column
* @method array findByCode(string $code) Return Currency objects filtered by the code column
* @method array findBySymbol(string $symbol) Return Currency objects filtered by the symbol column
* @method array findByRate(double $rate) Return Currency objects filtered by the rate column
* @method array findByDefaultUtility(int $default_utility) Return Currency objects filtered by the default_utility column
* @method array findByCreatedAt(string $created_at) Return Currency objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Currency objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCurrencyQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCurrencyQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Currency', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CurrencyQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CurrencyQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CurrencyQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CurrencyQuery) {
return $criteria;
}
$query = new CurrencyQuery();
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 PropelPDO $con an optional connection object
*
* @return Currency|Currency[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CurrencyPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CurrencyPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Currency A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `NAME`, `CODE`, `SYMBOL`, `RATE`, `DEFAULT_UTILITY`, `CREATED_AT`, `UPDATED_AT` FROM `currency` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Currency();
$obj->hydrate($row);
CurrencyPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Currency|Currency[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Currency[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CurrencyQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CurrencyPeer::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 CurrencyQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CurrencyPeer::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 CurrencyQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CurrencyPeer::ID, $id, $comparison);
}
/**
* Filter the query on the name column
*
* Example usage:
* <code>
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
* </code>
*
* @param string $name The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CurrencyQuery The current query, for fluid interface
*/
public function filterByName($name = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($name)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $name)) {
$name = str_replace('*', '%', $name);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CurrencyPeer::NAME, $name, $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 CurrencyQuery 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(CurrencyPeer::CODE, $code, $comparison);
}
/**
* Filter the query on the symbol column
*
* Example usage:
* <code>
* $query->filterBySymbol('fooValue'); // WHERE symbol = 'fooValue'
* $query->filterBySymbol('%fooValue%'); // WHERE symbol LIKE '%fooValue%'
* </code>
*
* @param string $symbol 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 CurrencyQuery The current query, for fluid interface
*/
public function filterBySymbol($symbol = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($symbol)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $symbol)) {
$symbol = str_replace('*', '%', $symbol);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CurrencyPeer::SYMBOL, $symbol, $comparison);
}
/**
* Filter the query on the rate column
*
* Example usage:
* <code>
* $query->filterByRate(1234); // WHERE rate = 1234
* $query->filterByRate(array(12, 34)); // WHERE rate IN (12, 34)
* $query->filterByRate(array('min' => 12)); // WHERE rate > 12
* </code>
*
* @param mixed $rate 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 CurrencyQuery The current query, for fluid interface
*/
public function filterByRate($rate = null, $comparison = null)
{
if (is_array($rate)) {
$useMinMax = false;
if (isset($rate['min'])) {
$this->addUsingAlias(CurrencyPeer::RATE, $rate['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($rate['max'])) {
$this->addUsingAlias(CurrencyPeer::RATE, $rate['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CurrencyPeer::RATE, $rate, $comparison);
}
/**
* Filter the query on the default_utility column
*
* Example usage:
* <code>
* $query->filterByDefaultUtility(1234); // WHERE default_utility = 1234
* $query->filterByDefaultUtility(array(12, 34)); // WHERE default_utility IN (12, 34)
* $query->filterByDefaultUtility(array('min' => 12)); // WHERE default_utility > 12
* </code>
*
* @param mixed $defaultUtility 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 CurrencyQuery The current query, for fluid interface
*/
public function filterByDefaultUtility($defaultUtility = null, $comparison = null)
{
if (is_array($defaultUtility)) {
$useMinMax = false;
if (isset($defaultUtility['min'])) {
$this->addUsingAlias(CurrencyPeer::DEFAULT_UTILITY, $defaultUtility['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($defaultUtility['max'])) {
$this->addUsingAlias(CurrencyPeer::DEFAULT_UTILITY, $defaultUtility['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CurrencyPeer::DEFAULT_UTILITY, $defaultUtility, $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 CurrencyQuery 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(CurrencyPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CurrencyPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CurrencyPeer::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 CurrencyQuery 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(CurrencyPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CurrencyPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CurrencyPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Order object
*
* @param Order|PropelObjectCollection $order the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CurrencyQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByOrder($order, $comparison = null)
{
if ($order instanceof Order) {
return $this
->addUsingAlias(CurrencyPeer::ID, $order->getCurrencyId(), $comparison);
} elseif ($order instanceof PropelObjectCollection) {
return $this
->useOrderQuery()
->filterByPrimaryKeys($order->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByOrder() only accepts arguments of type Order or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Order relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CurrencyQuery The current query, for fluid interface
*/
public function joinOrder($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Order');
// 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, 'Order');
}
return $this;
}
/**
* Use the Order relation Order 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\OrderQuery A secondary query class using the current class as primary query
*/
public function useOrderQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinOrder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
}
/**
* Exclude object from result
*
* @param Currency $currency Object to remove from the list of results
*
* @return CurrencyQuery The current query, for fluid interface
*/
public function prune($currency = null)
{
if ($currency) {
$this->addUsingAlias(CurrencyPeer::ID, $currency->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,580 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\CustomerTitle;
use Thelia\Model\CustomerTitleDesc;
use Thelia\Model\CustomerTitleDescPeer;
use Thelia\Model\CustomerTitleDescQuery;
/**
* Base class that represents a query for the 'customer_title_desc' table.
*
*
*
* @method CustomerTitleDescQuery orderById($order = Criteria::ASC) Order by the id column
* @method CustomerTitleDescQuery orderByCustomerTitleId($order = Criteria::ASC) Order by the customer_title_id column
* @method CustomerTitleDescQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method CustomerTitleDescQuery orderByShort($order = Criteria::ASC) Order by the short column
* @method CustomerTitleDescQuery orderByLong($order = Criteria::ASC) Order by the long column
* @method CustomerTitleDescQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method CustomerTitleDescQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method CustomerTitleDescQuery groupById() Group by the id column
* @method CustomerTitleDescQuery groupByCustomerTitleId() Group by the customer_title_id column
* @method CustomerTitleDescQuery groupByLang() Group by the lang column
* @method CustomerTitleDescQuery groupByShort() Group by the short column
* @method CustomerTitleDescQuery groupByLong() Group by the long column
* @method CustomerTitleDescQuery groupByCreatedAt() Group by the created_at column
* @method CustomerTitleDescQuery groupByUpdatedAt() Group by the updated_at column
*
* @method CustomerTitleDescQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CustomerTitleDescQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CustomerTitleDescQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CustomerTitleDescQuery leftJoinCustomerTitle($relationAlias = null) Adds a LEFT JOIN clause to the query using the CustomerTitle relation
* @method CustomerTitleDescQuery rightJoinCustomerTitle($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CustomerTitle relation
* @method CustomerTitleDescQuery innerJoinCustomerTitle($relationAlias = null) Adds a INNER JOIN clause to the query using the CustomerTitle relation
*
* @method CustomerTitleDesc findOne(PropelPDO $con = null) Return the first CustomerTitleDesc matching the query
* @method CustomerTitleDesc findOneOrCreate(PropelPDO $con = null) Return the first CustomerTitleDesc matching the query, or a new CustomerTitleDesc object populated from the query conditions when no match is found
*
* @method CustomerTitleDesc findOneById(int $id) Return the first CustomerTitleDesc filtered by the id column
* @method CustomerTitleDesc findOneByCustomerTitleId(int $customer_title_id) Return the first CustomerTitleDesc filtered by the customer_title_id column
* @method CustomerTitleDesc findOneByLang(string $lang) Return the first CustomerTitleDesc filtered by the lang column
* @method CustomerTitleDesc findOneByShort(string $short) Return the first CustomerTitleDesc filtered by the short column
* @method CustomerTitleDesc findOneByLong(string $long) Return the first CustomerTitleDesc filtered by the long column
* @method CustomerTitleDesc findOneByCreatedAt(string $created_at) Return the first CustomerTitleDesc filtered by the created_at column
* @method CustomerTitleDesc findOneByUpdatedAt(string $updated_at) Return the first CustomerTitleDesc filtered by the updated_at column
*
* @method array findById(int $id) Return CustomerTitleDesc objects filtered by the id column
* @method array findByCustomerTitleId(int $customer_title_id) Return CustomerTitleDesc objects filtered by the customer_title_id column
* @method array findByLang(string $lang) Return CustomerTitleDesc objects filtered by the lang column
* @method array findByShort(string $short) Return CustomerTitleDesc objects filtered by the short column
* @method array findByLong(string $long) Return CustomerTitleDesc objects filtered by the long column
* @method array findByCreatedAt(string $created_at) Return CustomerTitleDesc objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return CustomerTitleDesc objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCustomerTitleDescQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCustomerTitleDescQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\CustomerTitleDesc', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CustomerTitleDescQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CustomerTitleDescQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CustomerTitleDescQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CustomerTitleDescQuery) {
return $criteria;
}
$query = new CustomerTitleDescQuery();
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 PropelPDO $con an optional connection object
*
* @return CustomerTitleDesc|CustomerTitleDesc[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CustomerTitleDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CustomerTitleDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CustomerTitleDesc A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `CUSTOMER_TITLE_ID`, `LANG`, `SHORT`, `LONG`, `CREATED_AT`, `UPDATED_AT` FROM `customer_title_desc` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CustomerTitleDesc();
$obj->hydrate($row);
CustomerTitleDescPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CustomerTitleDesc|CustomerTitleDesc[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|CustomerTitleDesc[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CustomerTitleDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CustomerTitleDescPeer::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 CustomerTitleDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CustomerTitleDescPeer::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 CustomerTitleDescQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CustomerTitleDescPeer::ID, $id, $comparison);
}
/**
* Filter the query on the customer_title_id column
*
* Example usage:
* <code>
* $query->filterByCustomerTitleId(1234); // WHERE customer_title_id = 1234
* $query->filterByCustomerTitleId(array(12, 34)); // WHERE customer_title_id IN (12, 34)
* $query->filterByCustomerTitleId(array('min' => 12)); // WHERE customer_title_id > 12
* </code>
*
* @see filterByCustomerTitle()
*
* @param mixed $customerTitleId 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 CustomerTitleDescQuery The current query, for fluid interface
*/
public function filterByCustomerTitleId($customerTitleId = null, $comparison = null)
{
if (is_array($customerTitleId)) {
$useMinMax = false;
if (isset($customerTitleId['min'])) {
$this->addUsingAlias(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $customerTitleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($customerTitleId['max'])) {
$this->addUsingAlias(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $customerTitleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $customerTitleId, $comparison);
}
/**
* Filter the query on the lang column
*
* Example usage:
* <code>
* $query->filterByLang('fooValue'); // WHERE lang = 'fooValue'
* $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
* </code>
*
* @param string $lang 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 CustomerTitleDescQuery The current query, for fluid interface
*/
public function filterByLang($lang = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lang)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lang)) {
$lang = str_replace('*', '%', $lang);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerTitleDescPeer::LANG, $lang, $comparison);
}
/**
* Filter the query on the short column
*
* Example usage:
* <code>
* $query->filterByShort('fooValue'); // WHERE short = 'fooValue'
* $query->filterByShort('%fooValue%'); // WHERE short LIKE '%fooValue%'
* </code>
*
* @param string $short 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 CustomerTitleDescQuery The current query, for fluid interface
*/
public function filterByShort($short = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($short)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $short)) {
$short = str_replace('*', '%', $short);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerTitleDescPeer::SHORT, $short, $comparison);
}
/**
* Filter the query on the long column
*
* Example usage:
* <code>
* $query->filterByLong('fooValue'); // WHERE long = 'fooValue'
* $query->filterByLong('%fooValue%'); // WHERE long LIKE '%fooValue%'
* </code>
*
* @param string $long 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 CustomerTitleDescQuery The current query, for fluid interface
*/
public function filterByLong($long = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($long)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $long)) {
$long = str_replace('*', '%', $long);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerTitleDescPeer::LONG, $long, $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 CustomerTitleDescQuery 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(CustomerTitleDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CustomerTitleDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CustomerTitleDescPeer::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 CustomerTitleDescQuery 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(CustomerTitleDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CustomerTitleDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CustomerTitleDescPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related CustomerTitle object
*
* @param CustomerTitle|PropelObjectCollection $customerTitle The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CustomerTitleDescQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCustomerTitle($customerTitle, $comparison = null)
{
if ($customerTitle instanceof CustomerTitle) {
return $this
->addUsingAlias(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $customerTitle->getId(), $comparison);
} elseif ($customerTitle instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CustomerTitleDescPeer::CUSTOMER_TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCustomerTitle() only accepts arguments of type CustomerTitle or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the CustomerTitle relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CustomerTitleDescQuery The current query, for fluid interface
*/
public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CustomerTitle');
// 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, 'CustomerTitle');
}
return $this;
}
/**
* Use the CustomerTitle relation CustomerTitle 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\CustomerTitleQuery A secondary query class using the current class as primary query
*/
public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCustomerTitle($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\Thelia\Model\CustomerTitleQuery');
}
/**
* Exclude object from result
*
* @param CustomerTitleDesc $customerTitleDesc Object to remove from the list of results
*
* @return CustomerTitleDescQuery The current query, for fluid interface
*/
public function prune($customerTitleDesc = null)
{
if ($customerTitleDesc) {
$this->addUsingAlias(CustomerTitleDescPeer::ID, $customerTitleDesc->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

View File

@@ -0,0 +1,791 @@
<?php
namespace Thelia\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\CustomerPeer;
use Thelia\Model\CustomerTitle;
use Thelia\Model\CustomerTitleDescPeer;
use Thelia\Model\CustomerTitlePeer;
use Thelia\Model\map\CustomerTitleTableMap;
/**
* Base static class for performing query and update operations on the 'customer_title' table.
*
*
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCustomerTitlePeer
{
/** the default database name for this class */
const DATABASE_NAME = 'thelia';
/** the table name for this class */
const TABLE_NAME = 'customer_title';
/** the related Propel class for this table */
const OM_CLASS = 'Thelia\\Model\\CustomerTitle';
/** the related TableMap class for this table */
const TM_CLASS = 'CustomerTitleTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 5;
/** 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 = 5;
/** the column name for the ID field */
const ID = 'customer_title.ID';
/** the column name for the DEFAULT_UTILITY field */
const DEFAULT_UTILITY = 'customer_title.DEFAULT_UTILITY';
/** the column name for the POSITION field */
const POSITION = 'customer_title.POSITION';
/** the column name for the CREATED_AT field */
const CREATED_AT = 'customer_title.CREATED_AT';
/** the column name for the UPDATED_AT field */
const UPDATED_AT = 'customer_title.UPDATED_AT';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CustomerTitle objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CustomerTitle[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. CustomerTitlePeer::$fieldNames[CustomerTitlePeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'DefaultUtility', 'Position', 'CreatedAt', 'UpdatedAt', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'defaultUtility', 'position', 'createdAt', 'updatedAt', ),
BasePeer::TYPE_COLNAME => array (CustomerTitlePeer::ID, CustomerTitlePeer::DEFAULT_UTILITY, CustomerTitlePeer::POSITION, CustomerTitlePeer::CREATED_AT, CustomerTitlePeer::UPDATED_AT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DEFAULT_UTILITY', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'default_utility', 'position', 'created_at', 'updated_at', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. CustomerTitlePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'DefaultUtility' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'defaultUtility' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
BasePeer::TYPE_COLNAME => array (CustomerTitlePeer::ID => 0, CustomerTitlePeer::DEFAULT_UTILITY => 1, CustomerTitlePeer::POSITION => 2, CustomerTitlePeer::CREATED_AT => 3, CustomerTitlePeer::UPDATED_AT => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DEFAULT_UTILITY' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'default_utility' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = CustomerTitlePeer::getFieldNames($toType);
$key = isset(CustomerTitlePeer::$fieldKeys[$fromType][$name]) ? CustomerTitlePeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CustomerTitlePeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, CustomerTitlePeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return CustomerTitlePeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CustomerTitlePeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CustomerTitlePeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(CustomerTitlePeer::ID);
$criteria->addSelectColumn(CustomerTitlePeer::DEFAULT_UTILITY);
$criteria->addSelectColumn(CustomerTitlePeer::POSITION);
$criteria->addSelectColumn(CustomerTitlePeer::CREATED_AT);
$criteria->addSelectColumn(CustomerTitlePeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.DEFAULT_UTILITY');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CustomerTitlePeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CustomerTitlePeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(CustomerTitlePeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CustomerTitlePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return CustomerTitle
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = CustomerTitlePeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return CustomerTitlePeer::populateObjects(CustomerTitlePeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CustomerTitlePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CustomerTitlePeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(CustomerTitlePeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CustomerTitle $obj A CustomerTitle object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
CustomerTitlePeer::$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 CustomerTitle object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof CustomerTitle) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CustomerTitle object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(CustomerTitlePeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return CustomerTitle Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(CustomerTitlePeer::$instances[$key])) {
return CustomerTitlePeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
CustomerTitlePeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to customer_title
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in CustomerPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CustomerPeer::clearInstancePool();
// Invalidate objects in CustomerTitleDescPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CustomerTitleDescPeer::clearInstancePool();
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = CustomerTitlePeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CustomerTitlePeer::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;
CustomerTitlePeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (CustomerTitle object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CustomerTitlePeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CustomerTitlePeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CustomerTitlePeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CustomerTitlePeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(CustomerTitlePeer::DATABASE_NAME)->getTable(CustomerTitlePeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCustomerTitlePeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCustomerTitlePeer::TABLE_NAME)) {
$dbMap->addTableObject(new CustomerTitleTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass()
{
return CustomerTitlePeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a CustomerTitle or Criteria object.
*
* @param mixed $values Criteria or CustomerTitle object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CustomerTitlePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from CustomerTitle object
}
if ($criteria->containsKey(CustomerTitlePeer::ID) && $criteria->keyContainsValue(CustomerTitlePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CustomerTitlePeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(CustomerTitlePeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a CustomerTitle or Criteria object.
*
* @param mixed $values Criteria or CustomerTitle object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CustomerTitlePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(CustomerTitlePeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CustomerTitlePeer::ID);
$value = $criteria->remove(CustomerTitlePeer::ID);
if ($value) {
$selectCriteria->add(CustomerTitlePeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CustomerTitlePeer::TABLE_NAME);
}
} else { // $values is CustomerTitle object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(CustomerTitlePeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the customer_title table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CustomerTitlePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(CustomerTitlePeer::TABLE_NAME, $con, CustomerTitlePeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CustomerTitlePeer::clearInstancePool();
CustomerTitlePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a CustomerTitle or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CustomerTitle object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CustomerTitlePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
CustomerTitlePeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof CustomerTitle) { // it's a model object
// invalidate the cache for this single object
CustomerTitlePeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(CustomerTitlePeer::DATABASE_NAME);
$criteria->add(CustomerTitlePeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CustomerTitlePeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(CustomerTitlePeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
CustomerTitlePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given CustomerTitle object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param CustomerTitle $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CustomerTitlePeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CustomerTitlePeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(CustomerTitlePeer::DATABASE_NAME, CustomerTitlePeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return CustomerTitle
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CustomerTitlePeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CustomerTitlePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CustomerTitlePeer::DATABASE_NAME);
$criteria->add(CustomerTitlePeer::ID, $pk);
$v = CustomerTitlePeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CustomerTitle[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CustomerTitlePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CustomerTitlePeer::DATABASE_NAME);
$criteria->add(CustomerTitlePeer::ID, $pks, Criteria::IN);
$objs = CustomerTitlePeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCustomerTitlePeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCustomerTitlePeer::buildTableMap();

View File

@@ -0,0 +1,668 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Address;
use Thelia\Model\Customer;
use Thelia\Model\CustomerTitle;
use Thelia\Model\CustomerTitleDesc;
use Thelia\Model\CustomerTitlePeer;
use Thelia\Model\CustomerTitleQuery;
/**
* Base class that represents a query for the 'customer_title' table.
*
*
*
* @method CustomerTitleQuery orderById($order = Criteria::ASC) Order by the id column
* @method CustomerTitleQuery orderByDefaultUtility($order = Criteria::ASC) Order by the default_utility column
* @method CustomerTitleQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method CustomerTitleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method CustomerTitleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method CustomerTitleQuery groupById() Group by the id column
* @method CustomerTitleQuery groupByDefaultUtility() Group by the default_utility column
* @method CustomerTitleQuery groupByPosition() Group by the position column
* @method CustomerTitleQuery groupByCreatedAt() Group by the created_at column
* @method CustomerTitleQuery groupByUpdatedAt() Group by the updated_at column
*
* @method CustomerTitleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CustomerTitleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CustomerTitleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CustomerTitleQuery leftJoinAddress($relationAlias = null) Adds a LEFT JOIN clause to the query using the Address relation
* @method CustomerTitleQuery rightJoinAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Address relation
* @method CustomerTitleQuery innerJoinAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the Address relation
*
* @method CustomerTitleQuery leftJoinCustomer($relationAlias = null) Adds a LEFT JOIN clause to the query using the Customer relation
* @method CustomerTitleQuery rightJoinCustomer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Customer relation
* @method CustomerTitleQuery innerJoinCustomer($relationAlias = null) Adds a INNER JOIN clause to the query using the Customer relation
*
* @method CustomerTitleQuery leftJoinCustomerTitleDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the CustomerTitleDesc relation
* @method CustomerTitleQuery rightJoinCustomerTitleDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CustomerTitleDesc relation
* @method CustomerTitleQuery innerJoinCustomerTitleDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the CustomerTitleDesc relation
*
* @method CustomerTitle findOne(PropelPDO $con = null) Return the first CustomerTitle matching the query
* @method CustomerTitle findOneOrCreate(PropelPDO $con = null) Return the first CustomerTitle matching the query, or a new CustomerTitle object populated from the query conditions when no match is found
*
* @method CustomerTitle findOneById(int $id) Return the first CustomerTitle filtered by the id column
* @method CustomerTitle findOneByDefaultUtility(int $default_utility) Return the first CustomerTitle filtered by the default_utility column
* @method CustomerTitle findOneByPosition(string $position) Return the first CustomerTitle filtered by the position column
* @method CustomerTitle findOneByCreatedAt(string $created_at) Return the first CustomerTitle filtered by the created_at column
* @method CustomerTitle findOneByUpdatedAt(string $updated_at) Return the first CustomerTitle filtered by the updated_at column
*
* @method array findById(int $id) Return CustomerTitle objects filtered by the id column
* @method array findByDefaultUtility(int $default_utility) Return CustomerTitle objects filtered by the default_utility column
* @method array findByPosition(string $position) Return CustomerTitle objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return CustomerTitle objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return CustomerTitle objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseCustomerTitleQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCustomerTitleQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\CustomerTitle', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CustomerTitleQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CustomerTitleQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CustomerTitleQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CustomerTitleQuery) {
return $criteria;
}
$query = new CustomerTitleQuery();
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 PropelPDO $con an optional connection object
*
* @return CustomerTitle|CustomerTitle[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CustomerTitlePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CustomerTitlePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CustomerTitle A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `DEFAULT_UTILITY`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `customer_title` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CustomerTitle();
$obj->hydrate($row);
CustomerTitlePeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CustomerTitle|CustomerTitle[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|CustomerTitle[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CustomerTitleQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CustomerTitlePeer::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 CustomerTitleQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CustomerTitlePeer::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 CustomerTitleQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CustomerTitlePeer::ID, $id, $comparison);
}
/**
* Filter the query on the default_utility column
*
* Example usage:
* <code>
* $query->filterByDefaultUtility(1234); // WHERE default_utility = 1234
* $query->filterByDefaultUtility(array(12, 34)); // WHERE default_utility IN (12, 34)
* $query->filterByDefaultUtility(array('min' => 12)); // WHERE default_utility > 12
* </code>
*
* @param mixed $defaultUtility 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 CustomerTitleQuery The current query, for fluid interface
*/
public function filterByDefaultUtility($defaultUtility = null, $comparison = null)
{
if (is_array($defaultUtility)) {
$useMinMax = false;
if (isset($defaultUtility['min'])) {
$this->addUsingAlias(CustomerTitlePeer::DEFAULT_UTILITY, $defaultUtility['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($defaultUtility['max'])) {
$this->addUsingAlias(CustomerTitlePeer::DEFAULT_UTILITY, $defaultUtility['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CustomerTitlePeer::DEFAULT_UTILITY, $defaultUtility, $comparison);
}
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition('fooValue'); // WHERE position = 'fooValue'
* $query->filterByPosition('%fooValue%'); // WHERE position LIKE '%fooValue%'
* </code>
*
* @param string $position 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 CustomerTitleQuery The current query, for fluid interface
*/
public function filterByPosition($position = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($position)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $position)) {
$position = str_replace('*', '%', $position);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerTitlePeer::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 CustomerTitleQuery 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(CustomerTitlePeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CustomerTitlePeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CustomerTitlePeer::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 CustomerTitleQuery 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(CustomerTitlePeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CustomerTitlePeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CustomerTitlePeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Address object
*
* @param Address|PropelObjectCollection $address the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CustomerTitleQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByAddress($address, $comparison = null)
{
if ($address instanceof Address) {
return $this
->addUsingAlias(CustomerTitlePeer::ID, $address->getCustomerTitleId(), $comparison);
} elseif ($address instanceof PropelObjectCollection) {
return $this
->useAddressQuery()
->filterByPrimaryKeys($address->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAddress() only accepts arguments of type Address or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Address relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CustomerTitleQuery The current query, for fluid interface
*/
public function joinAddress($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Address');
// 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, 'Address');
}
return $this;
}
/**
* Use the Address relation Address 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\AddressQuery A secondary query class using the current class as primary query
*/
public function useAddressQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinAddress($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Address', '\Thelia\Model\AddressQuery');
}
/**
* Filter the query by a related Customer object
*
* @param Customer|PropelObjectCollection $customer the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CustomerTitleQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCustomer($customer, $comparison = null)
{
if ($customer instanceof Customer) {
return $this
->addUsingAlias(CustomerTitlePeer::ID, $customer->getCustomerTitleId(), $comparison);
} elseif ($customer instanceof PropelObjectCollection) {
return $this
->useCustomerQuery()
->filterByPrimaryKeys($customer->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCustomer() only accepts arguments of type Customer or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Customer relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CustomerTitleQuery The current query, for fluid interface
*/
public function joinCustomer($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Customer');
// 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, 'Customer');
}
return $this;
}
/**
* Use the Customer relation Customer 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\CustomerQuery A secondary query class using the current class as primary query
*/
public function useCustomerQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCustomer($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Customer', '\Thelia\Model\CustomerQuery');
}
/**
* Filter the query by a related CustomerTitleDesc object
*
* @param CustomerTitleDesc|PropelObjectCollection $customerTitleDesc the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CustomerTitleQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCustomerTitleDesc($customerTitleDesc, $comparison = null)
{
if ($customerTitleDesc instanceof CustomerTitleDesc) {
return $this
->addUsingAlias(CustomerTitlePeer::ID, $customerTitleDesc->getCustomerTitleId(), $comparison);
} elseif ($customerTitleDesc instanceof PropelObjectCollection) {
return $this
->useCustomerTitleDescQuery()
->filterByPrimaryKeys($customerTitleDesc->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCustomerTitleDesc() only accepts arguments of type CustomerTitleDesc or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the CustomerTitleDesc relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CustomerTitleQuery The current query, for fluid interface
*/
public function joinCustomerTitleDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CustomerTitleDesc');
// 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, 'CustomerTitleDesc');
}
return $this;
}
/**
* Use the CustomerTitleDesc relation CustomerTitleDesc 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\CustomerTitleDescQuery A secondary query class using the current class as primary query
*/
public function useCustomerTitleDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCustomerTitleDesc($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CustomerTitleDesc', '\Thelia\Model\CustomerTitleDescQuery');
}
/**
* Exclude object from result
*
* @param CustomerTitle $customerTitle Object to remove from the list of results
*
* @return CustomerTitleQuery The current query, for fluid interface
*/
public function prune($customerTitle = null)
{
if ($customerTitle) {
$this->addUsingAlias(CustomerTitlePeer::ID, $customerTitle->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,514 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Area;
use Thelia\Model\Delivzone;
use Thelia\Model\DelivzonePeer;
use Thelia\Model\DelivzoneQuery;
/**
* Base class that represents a query for the 'delivzone' table.
*
*
*
* @method DelivzoneQuery orderById($order = Criteria::ASC) Order by the id column
* @method DelivzoneQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
* @method DelivzoneQuery orderByDelivery($order = Criteria::ASC) Order by the delivery column
* @method DelivzoneQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method DelivzoneQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method DelivzoneQuery groupById() Group by the id column
* @method DelivzoneQuery groupByAreaId() Group by the area_id column
* @method DelivzoneQuery groupByDelivery() Group by the delivery column
* @method DelivzoneQuery groupByCreatedAt() Group by the created_at column
* @method DelivzoneQuery groupByUpdatedAt() Group by the updated_at column
*
* @method DelivzoneQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method DelivzoneQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method DelivzoneQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method DelivzoneQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method DelivzoneQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method DelivzoneQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
*
* @method Delivzone findOne(PropelPDO $con = null) Return the first Delivzone matching the query
* @method Delivzone findOneOrCreate(PropelPDO $con = null) Return the first Delivzone matching the query, or a new Delivzone object populated from the query conditions when no match is found
*
* @method Delivzone findOneById(int $id) Return the first Delivzone filtered by the id column
* @method Delivzone findOneByAreaId(int $area_id) Return the first Delivzone filtered by the area_id column
* @method Delivzone findOneByDelivery(string $delivery) Return the first Delivzone filtered by the delivery column
* @method Delivzone findOneByCreatedAt(string $created_at) Return the first Delivzone filtered by the created_at column
* @method Delivzone findOneByUpdatedAt(string $updated_at) Return the first Delivzone filtered by the updated_at column
*
* @method array findById(int $id) Return Delivzone objects filtered by the id column
* @method array findByAreaId(int $area_id) Return Delivzone objects filtered by the area_id column
* @method array findByDelivery(string $delivery) Return Delivzone objects filtered by the delivery column
* @method array findByCreatedAt(string $created_at) Return Delivzone objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Delivzone objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseDelivzoneQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseDelivzoneQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Delivzone', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new DelivzoneQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param DelivzoneQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return DelivzoneQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof DelivzoneQuery) {
return $criteria;
}
$query = new DelivzoneQuery();
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 PropelPDO $con an optional connection object
*
* @return Delivzone|Delivzone[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = DelivzonePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(DelivzonePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Delivzone A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `AREA_ID`, `DELIVERY`, `CREATED_AT`, `UPDATED_AT` FROM `delivzone` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new Delivzone();
$obj->hydrate($row);
DelivzonePeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return Delivzone|Delivzone[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|Delivzone[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return DelivzoneQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(DelivzonePeer::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 DelivzoneQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(DelivzonePeer::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 DelivzoneQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(DelivzonePeer::ID, $id, $comparison);
}
/**
* Filter the query on the area_id column
*
* Example usage:
* <code>
* $query->filterByAreaId(1234); // WHERE area_id = 1234
* $query->filterByAreaId(array(12, 34)); // WHERE area_id IN (12, 34)
* $query->filterByAreaId(array('min' => 12)); // WHERE area_id > 12
* </code>
*
* @see filterByArea()
*
* @param mixed $areaId 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 DelivzoneQuery The current query, for fluid interface
*/
public function filterByAreaId($areaId = null, $comparison = null)
{
if (is_array($areaId)) {
$useMinMax = false;
if (isset($areaId['min'])) {
$this->addUsingAlias(DelivzonePeer::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($areaId['max'])) {
$this->addUsingAlias(DelivzonePeer::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(DelivzonePeer::AREA_ID, $areaId, $comparison);
}
/**
* Filter the query on the delivery column
*
* Example usage:
* <code>
* $query->filterByDelivery('fooValue'); // WHERE delivery = 'fooValue'
* $query->filterByDelivery('%fooValue%'); // WHERE delivery LIKE '%fooValue%'
* </code>
*
* @param string $delivery 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 DelivzoneQuery The current query, for fluid interface
*/
public function filterByDelivery($delivery = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($delivery)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $delivery)) {
$delivery = str_replace('*', '%', $delivery);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(DelivzonePeer::DELIVERY, $delivery, $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 DelivzoneQuery 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(DelivzonePeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(DelivzonePeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(DelivzonePeer::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 DelivzoneQuery 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(DelivzonePeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(DelivzonePeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(DelivzonePeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Area object
*
* @param Area|PropelObjectCollection $area The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return DelivzoneQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByArea($area, $comparison = null)
{
if ($area instanceof Area) {
return $this
->addUsingAlias(DelivzonePeer::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(DelivzonePeer::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByArea() only accepts arguments of type Area or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Area relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return DelivzoneQuery The current query, for fluid interface
*/
public function joinArea($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Area');
// 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, 'Area');
}
return $this;
}
/**
* Use the Area relation Area 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\AreaQuery A secondary query class using the current class as primary query
*/
public function useAreaQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinArea($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Area', '\Thelia\Model\AreaQuery');
}
/**
* Exclude object from result
*
* @param Delivzone $delivzone Object to remove from the list of results
*
* @return DelivzoneQuery The current query, for fluid interface
*/
public function prune($delivzone = null)
{
if ($delivzone) {
$this->addUsingAlias(DelivzonePeer::ID, $delivzone->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,613 @@
<?php
namespace Thelia\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Document;
use Thelia\Model\DocumentDesc;
use Thelia\Model\DocumentDescPeer;
use Thelia\Model\DocumentDescQuery;
/**
* Base class that represents a query for the 'document_desc' table.
*
*
*
* @method DocumentDescQuery orderById($order = Criteria::ASC) Order by the id column
* @method DocumentDescQuery orderByDocumentId($order = Criteria::ASC) Order by the document_id column
* @method DocumentDescQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method DocumentDescQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method DocumentDescQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method DocumentDescQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method DocumentDescQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method DocumentDescQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method DocumentDescQuery groupById() Group by the id column
* @method DocumentDescQuery groupByDocumentId() Group by the document_id column
* @method DocumentDescQuery groupByLang() Group by the lang column
* @method DocumentDescQuery groupByTitle() Group by the title column
* @method DocumentDescQuery groupByDescription() Group by the description column
* @method DocumentDescQuery groupByChapo() Group by the chapo column
* @method DocumentDescQuery groupByCreatedAt() Group by the created_at column
* @method DocumentDescQuery groupByUpdatedAt() Group by the updated_at column
*
* @method DocumentDescQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method DocumentDescQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method DocumentDescQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method DocumentDescQuery leftJoinDocument($relationAlias = null) Adds a LEFT JOIN clause to the query using the Document relation
* @method DocumentDescQuery rightJoinDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Document relation
* @method DocumentDescQuery innerJoinDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the Document relation
*
* @method DocumentDesc findOne(PropelPDO $con = null) Return the first DocumentDesc matching the query
* @method DocumentDesc findOneOrCreate(PropelPDO $con = null) Return the first DocumentDesc matching the query, or a new DocumentDesc object populated from the query conditions when no match is found
*
* @method DocumentDesc findOneById(int $id) Return the first DocumentDesc filtered by the id column
* @method DocumentDesc findOneByDocumentId(int $document_id) Return the first DocumentDesc filtered by the document_id column
* @method DocumentDesc findOneByLang(string $lang) Return the first DocumentDesc filtered by the lang column
* @method DocumentDesc findOneByTitle(string $title) Return the first DocumentDesc filtered by the title column
* @method DocumentDesc findOneByDescription(string $description) Return the first DocumentDesc filtered by the description column
* @method DocumentDesc findOneByChapo(string $chapo) Return the first DocumentDesc filtered by the chapo column
* @method DocumentDesc findOneByCreatedAt(string $created_at) Return the first DocumentDesc filtered by the created_at column
* @method DocumentDesc findOneByUpdatedAt(string $updated_at) Return the first DocumentDesc filtered by the updated_at column
*
* @method array findById(int $id) Return DocumentDesc objects filtered by the id column
* @method array findByDocumentId(int $document_id) Return DocumentDesc objects filtered by the document_id column
* @method array findByLang(string $lang) Return DocumentDesc objects filtered by the lang column
* @method array findByTitle(string $title) Return DocumentDesc objects filtered by the title column
* @method array findByDescription(string $description) Return DocumentDesc objects filtered by the description column
* @method array findByChapo(string $chapo) Return DocumentDesc objects filtered by the chapo column
* @method array findByCreatedAt(string $created_at) Return DocumentDesc objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return DocumentDesc objects filtered by the updated_at column
*
* @package propel.generator.Thelia.Model.om
*/
abstract class BaseDocumentDescQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseDocumentDescQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\DocumentDesc', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new DocumentDescQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param DocumentDescQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return DocumentDescQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof DocumentDescQuery) {
return $criteria;
}
$query = new DocumentDescQuery();
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 PropelPDO $con an optional connection object
*
* @return DocumentDesc|DocumentDesc[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = DocumentDescPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(DocumentDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return DocumentDesc A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `DOCUMENT_ID`, `LANG`, `TITLE`, `DESCRIPTION`, `CHAPO`, `CREATED_AT`, `UPDATED_AT` FROM `document_desc` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new DocumentDesc();
$obj->hydrate($row);
DocumentDescPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return DocumentDesc|DocumentDesc[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|DocumentDesc[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return DocumentDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(DocumentDescPeer::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 DocumentDescQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(DocumentDescPeer::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 DocumentDescQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(DocumentDescPeer::ID, $id, $comparison);
}
/**
* Filter the query on the document_id column
*
* Example usage:
* <code>
* $query->filterByDocumentId(1234); // WHERE document_id = 1234
* $query->filterByDocumentId(array(12, 34)); // WHERE document_id IN (12, 34)
* $query->filterByDocumentId(array('min' => 12)); // WHERE document_id > 12
* </code>
*
* @see filterByDocument()
*
* @param mixed $documentId 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 DocumentDescQuery The current query, for fluid interface
*/
public function filterByDocumentId($documentId = null, $comparison = null)
{
if (is_array($documentId)) {
$useMinMax = false;
if (isset($documentId['min'])) {
$this->addUsingAlias(DocumentDescPeer::DOCUMENT_ID, $documentId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($documentId['max'])) {
$this->addUsingAlias(DocumentDescPeer::DOCUMENT_ID, $documentId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(DocumentDescPeer::DOCUMENT_ID, $documentId, $comparison);
}
/**
* Filter the query on the lang column
*
* Example usage:
* <code>
* $query->filterByLang('fooValue'); // WHERE lang = 'fooValue'
* $query->filterByLang('%fooValue%'); // WHERE lang LIKE '%fooValue%'
* </code>
*
* @param string $lang 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 DocumentDescQuery The current query, for fluid interface
*/
public function filterByLang($lang = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lang)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $lang)) {
$lang = str_replace('*', '%', $lang);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(DocumentDescPeer::LANG, $lang, $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 DocumentDescQuery 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(DocumentDescPeer::TITLE, $title, $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 DocumentDescQuery 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(DocumentDescPeer::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo 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 DocumentDescQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(DocumentDescPeer::CHAPO, $chapo, $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 DocumentDescQuery 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(DocumentDescPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(DocumentDescPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(DocumentDescPeer::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 DocumentDescQuery 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(DocumentDescPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(DocumentDescPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(DocumentDescPeer::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related Document object
*
* @param Document|PropelObjectCollection $document The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return DocumentDescQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByDocument($document, $comparison = null)
{
if ($document instanceof Document) {
return $this
->addUsingAlias(DocumentDescPeer::DOCUMENT_ID, $document->getId(), $comparison);
} elseif ($document instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(DocumentDescPeer::DOCUMENT_ID, $document->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByDocument() only accepts arguments of type Document or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the Document relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return DocumentDescQuery The current query, for fluid interface
*/
public function joinDocument($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Document');
// 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, 'Document');
}
return $this;
}
/**
* Use the Document relation Document 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\DocumentQuery A secondary query class using the current class as primary query
*/
public function useDocumentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinDocument($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Document', '\Thelia\Model\DocumentQuery');
}
/**
* Exclude object from result
*
* @param DocumentDesc $documentDesc Object to remove from the list of results
*
* @return DocumentDescQuery The current query, for fluid interface
*/
public function prune($documentDesc = null)
{
if ($documentDesc) {
$this->addUsingAlias(DocumentDescPeer::ID, $documentDesc->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More