Initial commit

This commit is contained in:
2019-05-26 15:57:49 +02:00
commit 9f74ec1089
34290 changed files with 5059123 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,615 @@
<?php
namespace FreeDelivery\Model\Base;
use \Exception;
use \PDO;
use FreeDelivery\Model\FreeDeliveryCondition as ChildFreeDeliveryCondition;
use FreeDelivery\Model\FreeDeliveryConditionQuery as ChildFreeDeliveryConditionQuery;
use FreeDelivery\Model\Map\FreeDeliveryConditionTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Area;
use Thelia\Model\Module;
/**
* Base class that represents a query for the 'free_delivery_condition' table.
*
*
*
* @method ChildFreeDeliveryConditionQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
* @method ChildFreeDeliveryConditionQuery orderByModuleId($order = Criteria::ASC) Order by the module_id column
* @method ChildFreeDeliveryConditionQuery orderByAmount($order = Criteria::ASC) Order by the amount column
*
* @method ChildFreeDeliveryConditionQuery groupByAreaId() Group by the area_id column
* @method ChildFreeDeliveryConditionQuery groupByModuleId() Group by the module_id column
* @method ChildFreeDeliveryConditionQuery groupByAmount() Group by the amount column
*
* @method ChildFreeDeliveryConditionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildFreeDeliveryConditionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildFreeDeliveryConditionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildFreeDeliveryConditionQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method ChildFreeDeliveryConditionQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method ChildFreeDeliveryConditionQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
*
* @method ChildFreeDeliveryConditionQuery leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
* @method ChildFreeDeliveryConditionQuery rightJoinModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Module relation
* @method ChildFreeDeliveryConditionQuery innerJoinModule($relationAlias = null) Adds a INNER JOIN clause to the query using the Module relation
*
* @method ChildFreeDeliveryCondition findOne(ConnectionInterface $con = null) Return the first ChildFreeDeliveryCondition matching the query
* @method ChildFreeDeliveryCondition findOneOrCreate(ConnectionInterface $con = null) Return the first ChildFreeDeliveryCondition matching the query, or a new ChildFreeDeliveryCondition object populated from the query conditions when no match is found
*
* @method ChildFreeDeliveryCondition findOneByAreaId(int $area_id) Return the first ChildFreeDeliveryCondition filtered by the area_id column
* @method ChildFreeDeliveryCondition findOneByModuleId(int $module_id) Return the first ChildFreeDeliveryCondition filtered by the module_id column
* @method ChildFreeDeliveryCondition findOneByAmount(string $amount) Return the first ChildFreeDeliveryCondition filtered by the amount column
*
* @method array findByAreaId(int $area_id) Return ChildFreeDeliveryCondition objects filtered by the area_id column
* @method array findByModuleId(int $module_id) Return ChildFreeDeliveryCondition objects filtered by the module_id column
* @method array findByAmount(string $amount) Return ChildFreeDeliveryCondition objects filtered by the amount column
*
*/
abstract class FreeDeliveryConditionQuery extends ModelCriteria
{
/**
* Initializes internal state of \FreeDelivery\Model\Base\FreeDeliveryConditionQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\FreeDelivery\\Model\\FreeDeliveryCondition', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildFreeDeliveryConditionQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildFreeDeliveryConditionQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \FreeDelivery\Model\FreeDeliveryConditionQuery) {
return $criteria;
}
$query = new \FreeDelivery\Model\FreeDeliveryConditionQuery();
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[$area_id, $module_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildFreeDeliveryCondition|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = FreeDeliveryConditionTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(FreeDeliveryConditionTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildFreeDeliveryCondition A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT AREA_ID, MODULE_ID, AMOUNT FROM free_delivery_condition WHERE AREA_ID = :p0 AND MODULE_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), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildFreeDeliveryCondition();
$obj->hydrate($row);
FreeDeliveryConditionTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildFreeDeliveryCondition|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildFreeDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(FreeDeliveryConditionTableMap::AREA_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(FreeDeliveryConditionTableMap::MODULE_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 ChildFreeDeliveryConditionQuery 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(FreeDeliveryConditionTableMap::AREA_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(FreeDeliveryConditionTableMap::MODULE_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* 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 ChildFreeDeliveryConditionQuery 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(FreeDeliveryConditionTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($areaId['max'])) {
$this->addUsingAlias(FreeDeliveryConditionTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(FreeDeliveryConditionTableMap::AREA_ID, $areaId, $comparison);
}
/**
* Filter the query on the module_id column
*
* Example usage:
* <code>
* $query->filterByModuleId(1234); // WHERE module_id = 1234
* $query->filterByModuleId(array(12, 34)); // WHERE module_id IN (12, 34)
* $query->filterByModuleId(array('min' => 12)); // WHERE module_id > 12
* </code>
*
* @see filterByModule()
*
* @param mixed $moduleId 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 ChildFreeDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByModuleId($moduleId = null, $comparison = null)
{
if (is_array($moduleId)) {
$useMinMax = false;
if (isset($moduleId['min'])) {
$this->addUsingAlias(FreeDeliveryConditionTableMap::MODULE_ID, $moduleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($moduleId['max'])) {
$this->addUsingAlias(FreeDeliveryConditionTableMap::MODULE_ID, $moduleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(FreeDeliveryConditionTableMap::MODULE_ID, $moduleId, $comparison);
}
/**
* Filter the query on the amount column
*
* Example usage:
* <code>
* $query->filterByAmount(1234); // WHERE amount = 1234
* $query->filterByAmount(array(12, 34)); // WHERE amount IN (12, 34)
* $query->filterByAmount(array('min' => 12)); // WHERE amount > 12
* </code>
*
* @param mixed $amount 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 ChildFreeDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByAmount($amount = null, $comparison = null)
{
if (is_array($amount)) {
$useMinMax = false;
if (isset($amount['min'])) {
$this->addUsingAlias(FreeDeliveryConditionTableMap::AMOUNT, $amount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($amount['max'])) {
$this->addUsingAlias(FreeDeliveryConditionTableMap::AMOUNT, $amount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(FreeDeliveryConditionTableMap::AMOUNT, $amount, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Area object
*
* @param \Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFreeDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByArea($area, $comparison = null)
{
if ($area instanceof \Thelia\Model\Area) {
return $this
->addUsingAlias(FreeDeliveryConditionTableMap::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(FreeDeliveryConditionTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByArea() only accepts arguments of type \Thelia\Model\Area or Collection');
}
}
/**
* 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 ChildFreeDeliveryConditionQuery The current query, for fluid interface
*/
public function joinArea($relationAlias = null, $joinType = Criteria::INNER_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::INNER_JOIN)
{
return $this
->joinArea($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Area', '\Thelia\Model\AreaQuery');
}
/**
* Filter the query by a related \Thelia\Model\Module object
*
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFreeDeliveryConditionQuery The current query, for fluid interface
*/
public function filterByModule($module, $comparison = null)
{
if ($module instanceof \Thelia\Model\Module) {
return $this
->addUsingAlias(FreeDeliveryConditionTableMap::MODULE_ID, $module->getId(), $comparison);
} elseif ($module instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(FreeDeliveryConditionTableMap::MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModule() only accepts arguments of type \Thelia\Model\Module or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Module relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildFreeDeliveryConditionQuery The current query, for fluid interface
*/
public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Module');
// 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, 'Module');
}
return $this;
}
/**
* Use the Module relation Module 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\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
}
/**
* Exclude object from result
*
* @param ChildFreeDeliveryCondition $freeDeliveryCondition Object to remove from the list of results
*
* @return ChildFreeDeliveryConditionQuery The current query, for fluid interface
*/
public function prune($freeDeliveryCondition = null)
{
if ($freeDeliveryCondition) {
$this->addCond('pruneCond0', $this->getAliasedColName(FreeDeliveryConditionTableMap::AREA_ID), $freeDeliveryCondition->getAreaId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(FreeDeliveryConditionTableMap::MODULE_ID), $freeDeliveryCondition->getModuleId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the free_delivery_condition table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(FreeDeliveryConditionTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
FreeDeliveryConditionTableMap::clearInstancePool();
FreeDeliveryConditionTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildFreeDeliveryCondition or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildFreeDeliveryCondition object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(FreeDeliveryConditionTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(FreeDeliveryConditionTableMap::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();
FreeDeliveryConditionTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
FreeDeliveryConditionTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // FreeDeliveryConditionQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace FreeDelivery\Model;
use FreeDelivery\Model\Base\FreeDeliveryCondition as BaseFreeDeliveryCondition;
class FreeDeliveryCondition extends BaseFreeDeliveryCondition
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace FreeDelivery\Model;
use FreeDelivery\Model\Base\FreeDeliveryConditionQuery as BaseFreeDeliveryConditionQuery;
/**
* Skeleton subclass for performing query and update operations on the 'free_delivery_condition' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*/
class FreeDeliveryConditionQuery extends BaseFreeDeliveryConditionQuery
{
} // FreeDeliveryConditionQuery

View File

@@ -0,0 +1,475 @@
<?php
namespace FreeDelivery\Model\Map;
use FreeDelivery\Model\FreeDeliveryCondition;
use FreeDelivery\Model\FreeDeliveryConditionQuery;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
/**
* This class defines the structure of the 'free_delivery_condition' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
*/
class FreeDeliveryConditionTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'FreeDelivery.Model.Map.FreeDeliveryConditionTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'free_delivery_condition';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\FreeDelivery\\Model\\FreeDeliveryCondition';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'FreeDelivery.Model.FreeDeliveryCondition';
/**
* The total number of columns
*/
const NUM_COLUMNS = 3;
/**
* 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 = 3;
/**
* the column name for the AREA_ID field
*/
const AREA_ID = 'free_delivery_condition.AREA_ID';
/**
* the column name for the MODULE_ID field
*/
const MODULE_ID = 'free_delivery_condition.MODULE_ID';
/**
* the column name for the AMOUNT field
*/
const AMOUNT = 'free_delivery_condition.AMOUNT';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('AreaId', 'ModuleId', 'Amount', ),
self::TYPE_STUDLYPHPNAME => array('areaId', 'moduleId', 'amount', ),
self::TYPE_COLNAME => array(FreeDeliveryConditionTableMap::AREA_ID, FreeDeliveryConditionTableMap::MODULE_ID, FreeDeliveryConditionTableMap::AMOUNT, ),
self::TYPE_RAW_COLNAME => array('AREA_ID', 'MODULE_ID', 'AMOUNT', ),
self::TYPE_FIELDNAME => array('area_id', 'module_id', 'amount', ),
self::TYPE_NUM => array(0, 1, 2, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('AreaId' => 0, 'ModuleId' => 1, 'Amount' => 2, ),
self::TYPE_STUDLYPHPNAME => array('areaId' => 0, 'moduleId' => 1, 'amount' => 2, ),
self::TYPE_COLNAME => array(FreeDeliveryConditionTableMap::AREA_ID => 0, FreeDeliveryConditionTableMap::MODULE_ID => 1, FreeDeliveryConditionTableMap::AMOUNT => 2, ),
self::TYPE_RAW_COLNAME => array('AREA_ID' => 0, 'MODULE_ID' => 1, 'AMOUNT' => 2, ),
self::TYPE_FIELDNAME => array('area_id' => 0, 'module_id' => 1, 'amount' => 2, ),
self::TYPE_NUM => array(0, 1, 2, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('free_delivery_condition');
$this->setPhpName('FreeDeliveryCondition');
$this->setClassName('\\FreeDelivery\\Model\\FreeDeliveryCondition');
$this->setPackage('FreeDelivery.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('AREA_ID', 'AreaId', 'INTEGER' , 'area', 'ID', true, null, null);
$this->addForeignPrimaryKey('MODULE_ID', 'ModuleId', 'INTEGER' , 'module', 'ID', true, null, null);
$this->addColumn('AMOUNT', 'Amount', 'DECIMAL', true, 16, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'CASCADE', null);
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('module_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by find*()
* and findPk*() calls.
*
* @param \FreeDelivery\Model\FreeDeliveryCondition $obj A \FreeDelivery\Model\FreeDeliveryCondition object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if (null === $key) {
$key = serialize(array((string) $obj->getAreaId(), (string) $obj->getModuleId()));
} // if key === null
self::$instances[$key] = $obj;
}
}
/**
* Removes an object from the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doDelete
* methods in your stub classes -- you may need to explicitly remove objects
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A \FreeDelivery\Model\FreeDeliveryCondition object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \FreeDelivery\Model\FreeDeliveryCondition) {
$key = serialize(array((string) $value->getAreaId(), (string) $value->getModuleId()));
} elseif (is_array($value) && count($value) === 2) {
// assume we've been passed a primary key";
$key = serialize(array((string) $value[0], (string) $value[1]));
} elseif ($value instanceof Criteria) {
self::$instances = [];
return;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \FreeDelivery\Model\FreeDeliveryCondition object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
throw $e;
}
unset(self::$instances[$key]);
}
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)]));
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return $pks;
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? FreeDeliveryConditionTableMap::CLASS_DEFAULT : FreeDeliveryConditionTableMap::OM_CLASS;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row row returned by DataFetcher->fetch().
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (FreeDeliveryCondition object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = FreeDeliveryConditionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = FreeDeliveryConditionTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $offset, true); // rehydrate
$col = $offset + FreeDeliveryConditionTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = FreeDeliveryConditionTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
FreeDeliveryConditionTableMap::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @param DataFetcherInterface $dataFetcher
* @return array
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(DataFetcherInterface $dataFetcher)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = static::getOMClass(false);
// populate the object(s)
while ($row = $dataFetcher->fetch()) {
$key = FreeDeliveryConditionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = FreeDeliveryConditionTableMap::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;
FreeDeliveryConditionTableMap::addInstanceToPool($obj, $key);
} // if key exists
}
return $results;
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(FreeDeliveryConditionTableMap::AREA_ID);
$criteria->addSelectColumn(FreeDeliveryConditionTableMap::MODULE_ID);
$criteria->addSelectColumn(FreeDeliveryConditionTableMap::AMOUNT);
} else {
$criteria->addSelectColumn($alias . '.AREA_ID');
$criteria->addSelectColumn($alias . '.MODULE_ID');
$criteria->addSelectColumn($alias . '.AMOUNT');
}
}
/**
* Returns the TableMap related to this object.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getServiceContainer()->getDatabaseMap(FreeDeliveryConditionTableMap::DATABASE_NAME)->getTable(FreeDeliveryConditionTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(FreeDeliveryConditionTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(FreeDeliveryConditionTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new FreeDeliveryConditionTableMap());
}
}
/**
* Performs a DELETE on the database, given a FreeDeliveryCondition or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or FreeDeliveryCondition object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(FreeDeliveryConditionTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \FreeDelivery\Model\FreeDeliveryCondition) { // it's a model object
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(FreeDeliveryConditionTableMap::DATABASE_NAME);
// primary key is composite; we therefore, expect
// the primary key passed to be an array of pkey values
if (count($values) == count($values, COUNT_RECURSIVE)) {
// array is not multi-dimensional
$values = array($values);
}
foreach ($values as $value) {
$criterion = $criteria->getNewCriterion(FreeDeliveryConditionTableMap::AREA_ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(FreeDeliveryConditionTableMap::MODULE_ID, $value[1]));
$criteria->addOr($criterion);
}
}
$query = FreeDeliveryConditionQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { FreeDeliveryConditionTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { FreeDeliveryConditionTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the free_delivery_condition table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll(ConnectionInterface $con = null)
{
return FreeDeliveryConditionQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a FreeDeliveryCondition or Criteria object.
*
* @param mixed $criteria Criteria or FreeDeliveryCondition object containing data that is used to create the INSERT statement.
* @param ConnectionInterface $con the ConnectionInterface connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(FreeDeliveryConditionTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from FreeDeliveryCondition object
}
// Set the correct dbName
$query = FreeDeliveryConditionQuery::create()->mergeWith($criteria);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = $query->doInsert($con);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
} // FreeDeliveryConditionTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
FreeDeliveryConditionTableMap::buildTableMap();