Begin import export management

modifié:         core/lib/Thelia/Config/Resources/config.xml
	modifié:         core/lib/Thelia/Config/Resources/form.xml
	modifié:         core/lib/Thelia/Config/Resources/loop.xml
	modifié:         core/lib/Thelia/Config/Resources/routing/admin.xml
	renommé:         core/lib/Thelia/Form/ImportExport/BaseExportForm.php -> core/lib/Thelia/Controller/Admin/CustomerExportController.php
	modifié:         core/lib/Thelia/Controller/Admin/ExportController.php
	modifié:         core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterArchiveBuilderPass.php
	modifié:         core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterFormatterPass.php
	nouveau fichier: core/lib/Thelia/Core/Template/Loop/ArchiveBuilder.php
	nouveau fichier: core/lib/Thelia/Core/Template/Loop/Formatter.php
	nouveau fichier: core/lib/Thelia/Model/Base/ImportExportCategory.php
	nouveau fichier: core/lib/Thelia/Model/Base/ImportExportCategoryI18n.php
	nouveau fichier: core/lib/Thelia/Model/Base/ImportExportCategoryI18nQuery.php
	nouveau fichier: core/lib/Thelia/Model/Base/ImportExportCategoryQuery.php
	nouveau fichier: core/lib/Thelia/Model/Base/ImportExportType.php
	nouveau fichier: core/lib/Thelia/Model/Base/ImportExportTypeI18n.php
	nouveau fichier: core/lib/Thelia/Model/Base/ImportExportTypeI18nQuery.php
	nouveau fichier: core/lib/Thelia/Model/Base/ImportExportTypeQuery.php
	nouveau fichier: core/lib/Thelia/Model/ImportExportCategory.php
	nouveau fichier: core/lib/Thelia/Model/ImportExportCategoryI18n.php
	nouveau fichier: core/lib/Thelia/Model/ImportExportCategoryI18nQuery.php
	nouveau fichier: core/lib/Thelia/Model/ImportExportCategoryQuery.php
	nouveau fichier: core/lib/Thelia/Model/ImportExportType.php
	nouveau fichier: core/lib/Thelia/Model/ImportExportTypeI18n.php
	nouveau fichier: core/lib/Thelia/Model/ImportExportTypeI18nQuery.php
	nouveau fichier: core/lib/Thelia/Model/ImportExportTypeQuery.php
	nouveau fichier: core/lib/Thelia/Model/Map/ImportExportCategoryI18nTableMap.php
	nouveau fichier: core/lib/Thelia/Model/Map/ImportExportCategoryTableMap.php
	nouveau fichier: core/lib/Thelia/Model/Map/ImportExportTypeI18nTableMap.php
	nouveau fichier: core/lib/Thelia/Model/Map/ImportExportTypeTableMap.php
	modifié:         local/config/schema.xml
	modifié:         setup/thelia.sql
	modifié:         templates/backOffice/default/export.html
	nouveau fichier: templates/backOffice/default/includes/export-form-definition.html
This commit is contained in:
Benjamin Perche
2014-07-09 15:57:23 +02:00
parent 168cb31253
commit d1f5087d00
34 changed files with 11313 additions and 75 deletions

View File

@@ -152,26 +152,27 @@
</service> </service>
<!-- zip --> <!-- zip -->
<service id="thelia.manager.zip_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\ZipArchiveBuilder"> <service id="thelia.archive_builder.zip_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\ZipArchiveBuilder">
<tag name="thelia.manager.archive_builder" /> <tag name="thelia.archive_builder" />
</service> </service>
<!-- tar --> <!-- tar -->
<service id="thelia.manager.tar_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarArchiveBuilder"> <service id="thelia.archive_builder.tar_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarArchiveBuilder">
<tag name="thelia.manager.archive_builder" /> <tag name="thelia.archive_builder" />
</service> </service>
<!-- tar.gz --> <!-- tar.gz -->
<service id="thelia.manager.tar_gz_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarGzArchiveBuilder"> <service id="thelia.archive_builder.tar_gz_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarGzArchiveBuilder">
<tag name="thelia.manager.archive_builder" /> <tag name="thelia.archive_builder" />
</service> </service>
<!-- tar.bz2 --> <!-- tar.bz2 -->
<service id="thelia.manager.tar_bz2_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarBz2ArchiveBuilder"> <service id="thelia.archive_builder.tar_bz2_archive_builder" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarBz2ArchiveBuilder">
<tag name="thelia.manager.archive_builder" /> <tag name="thelia.archive_builder" />
</service> </service>
<!-- Formatters --> <!-- Formatters -->
<<<<<<< HEAD
<service id="thelia.manager.formatter_manager" class="Thelia\Core\FileFormat\Formatter\FormatterManager" /> <service id="thelia.manager.formatter_manager" class="Thelia\Core\FileFormat\Formatter\FormatterManager" />
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD <<<<<<< HEAD
@@ -213,5 +214,16 @@
======= =======
>>>>>>> Readd services >>>>>>> Readd services
=======
<service id="thelia.manager.formatter_manager" class="Thelia\Core\FileFormat\Formatting\FormatterManager" />
<service id="thelia.formatter.xml_formatter" class="Thelia\Core\FileFormat\Formatting\Formatter\XMLFormatter">
<tag name="thelia.formatter" />
</service>
<service id="thelia.formatter.json_formatter" class="Thelia\Core\FileFormat\Formatting\Formatter\JsonFormatter">
<tag name="thelia.formatter" />
</service>
>>>>>>> Begin import export management
</services> </services>
</config> </config>

View File

@@ -133,6 +133,8 @@
<form name="thelia.assets.flush" class="Thelia\Form\Cache\AssetsFlushForm"/> <form name="thelia.assets.flush" class="Thelia\Form\Cache\AssetsFlushForm"/>
<form name="thelia.images-and-documents-cache.flush" class="Thelia\Form\Cache\ImagesAndDocumentsCacheFlushForm"/> <form name="thelia.images-and-documents-cache.flush" class="Thelia\Form\Cache\ImagesAndDocumentsCacheFlushForm"/>
<form name="thelia.admin.export" class="Thelia\Form\ExportForm" />
</forms> </forms>
</config> </config>

View File

@@ -55,6 +55,8 @@
<loop class="Thelia\Core\Template\Loop\Tax" name="tax"/> <loop class="Thelia\Core\Template\Loop\Tax" name="tax"/>
<loop class="Thelia\Core\Template\Loop\TaxRule" name="tax-rule"/> <loop class="Thelia\Core\Template\Loop\TaxRule" name="tax-rule"/>
<loop class="Thelia\Core\Template\Loop\TaxRuleCountry" name="tax-rule-country"/> <loop class="Thelia\Core\Template\Loop\TaxRuleCountry" name="tax-rule-country"/>
<loop class="Thelia\Core\Template\Loop\Formatter" name="formatter" />
<loop class="Thelia\Core\Template\Loop\ArchiveBuilder" name="archive-builder" />
</loops> </loops>

View File

@@ -1164,8 +1164,9 @@
<default key="_controller">Thelia\Controller\Admin\ExportController::indexAction</default> <default key="_controller">Thelia\Controller\Admin\ExportController::indexAction</default>
</route> </route>
<route id="export.customer.newsletter" path="/admin/export/customer/newsletter"> <route id="export.customer.newsletter" path="/admin/export/{exportType}">
<default key="_controller">Thelia\Controller\Admin\CustomerExportController::newsletterExportAction</default> <default key="_controller">Thelia\Controller\Admin\ExportController::export</default>
<requirement key="exportType">.+</requirement>
</route> </route>

View File

@@ -24,43 +24,18 @@ use Thelia\Model\NewsletterQuery;
*/ */
class CustomerExportController extends BaseAdminController class CustomerExportController extends BaseAdminController
{ {
public function newsletterSubscribers()
public function newsletterExportAction()
{ {
if (null !== $response = $this->checkAuth([AdminResources::EXPORT_CUSTOMER_NEWSLETTER], [], [AccessManager::VIEW])) {
return $response;
}
$data = NewsletterQuery::create()
->select([
'email',
'firstname',
'lastname',
'locale'
])
->find();
$handle = fopen('php://memory', 'r+');
fputcsv($handle, ['email','firstname','lastname','locale'], ';', '"');
foreach ($data->toArray() as $customer) {
fputcsv($handle, $customer, ';', '"');
}
rewind($handle);
$content = stream_get_contents($handle);
fclose($handle);
return Response::create(
$content,
200,
array(
"Content-Type"=>"application/csv-tab-delimited-table",
"Content-disposition"=>"filename=export_customer_newsletter.csv"
)
);
} }
public function customers()
{
}
public function mailing()
{
}
} }

View File

@@ -31,4 +31,9 @@ class ExportController extends BaseAdminController
return $this->render('export'); return $this->render('export');
} }
public function export($exportType)
{
}
} }

View File

@@ -24,7 +24,7 @@ class RegisterArchiveBuilderPass implements CompilerPassInterface
{ {
const MANAGER_DEFINITION = "thelia.manager.archive_builder_manager"; const MANAGER_DEFINITION = "thelia.manager.archive_builder_manager";
const SERVICE_TAG = "thelia.manager.archive_builder"; const SERVICE_TAG = "thelia.archive_builder";
/** /**
* You can modify the container here before it is dumped to PHP code. * You can modify the container here before it is dumped to PHP code.

View File

@@ -24,7 +24,7 @@ class RegisterFormatterPass implements CompilerPassInterface
{ {
const MANAGER_DEFINITION = "thelia.manager.formatter_manager"; const MANAGER_DEFINITION = "thelia.manager.formatter_manager";
const SERVICE_TAG = "thelia.manager.formatter"; const SERVICE_TAG = "thelia.formatter";
/** /**
* You can modify the container here before it is dumped to PHP code. * You can modify the container here before it is dumped to PHP code.

View File

@@ -0,0 +1,134 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Type\EnumType;
use Thelia\Type\TypeCollection;
/**
* Class ArchiveBuilder
* @package Thelia\Core\Template\Loop
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class ArchiveBuilder extends BaseLoop implements ArraySearchLoopInterface
{
/**
* this method returns an array
*
* @return array
*/
public function buildArray()
{
/** @var \Thelia\Core\FileFormat\Archive\archiveBuilderManager $service */
$service = $this->container->get("thelia.manager.archive_builder_manager");
$rawArchiveBuilders = array_change_key_case($service->getAll());
$allowedArchiveBuilder = $this->getAllowed_archive_builder();
$archiveBuilders = [];
if ($allowedArchiveBuilder !== null) {
$allowedArchiveBuilder = explode(",", $allowedArchiveBuilder);
foreach($allowedArchiveBuilder as $archiveBuilder) {
$archiveBuilder = trim(strtolower($archiveBuilder));
if (isset($rawArchiveBuilders[$archiveBuilder])) {
$archiveBuilders[$archiveBuilder] = $rawArchiveBuilders[$archiveBuilder];
}
}
} else {
$archiveBuilders = $rawArchiveBuilders;
}
switch ($this->getOrder()) {
case "alpha":
ksort($archiveBuilders);
break;
case "alpha_reverse":
krsort($archiveBuilders);
break;
}
return $archiveBuilders;
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var \Thelia\Core\FileFormat\Archive\AbstractarchiveBuilder $archiveBuilder */
foreach ($loopResult->getResultDataCollection() as $archiveBuilder) {
$loopResultRow = new LoopResultRow();
$loopResultRow
->set("NAME", $archiveBuilder->getName())
->set("EXTENSION", $archiveBuilder->getExtension())
->set("MIME_TYPE", $archiveBuilder->getMimeType())
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
/**
* Definition of loop arguments
*
* example :
*
* public function getArgDefinitions()
* {
* return new ArgumentCollection(
*
* Argument::createIntListTypeArgument('id'),
* new Argument(
* 'ref',
* new TypeCollection(
* new Type\AlphaNumStringListType()
* )
* ),
* Argument::createIntListTypeArgument('category'),
* Argument::createBooleanTypeArgument('new'),
* ...
* );
* }
*
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createAnyTypeArgument("allowed_archive_builder"),
new Argument(
"order",
new TypeCollection(
new EnumType(["alpha", "alpha_reverse"])
),
"alpha"
)
);
}
}

View File

@@ -0,0 +1,132 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Type\EnumType;
use Thelia\Type\TypeCollection;
/**
* Class Formatter
* @package Thelia\Core\Template\Loop
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class Formatter extends BaseLoop implements ArraySearchLoopInterface
{
/**
* this method returns an array
*
* @return array
*/
public function buildArray()
{
/** @var \Thelia\Core\FileFormat\Formatting\FormatterManager $service */
$service = $this->container->get("thelia.manager.formatter_manager");
$rawFormatters = array_change_key_case($service->getAll());
$allowedFormatter = $this->getAllowed_formatter();
$formatters = [];
if ($allowedFormatter !== null) {
$allowedFormatter = explode(",", $allowedFormatter);
foreach($allowedFormatter as $formatter) {
$formatter = trim(strtolower($formatter));
if (isset($rawFormatters[$formatter])) {
$formatters[$formatter] = $rawFormatters[$formatter];
}
}
} else {
$formatters = $rawFormatters;
}
switch ($this->getOrder()) {
case "alpha":
ksort($formatters);
break;
case "alpha_reverse":
krsort($formatters);
break;
}
return $formatters;
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var \Thelia\Core\FileFormat\Formatting\AbstractFormatter $formatter */
foreach ($loopResult->getResultDataCollection() as $formatter) {
$loopResultRow = new LoopResultRow();
$loopResultRow
->set("NAME", $formatter->getName())
->set("EXTENSION", $formatter->getExtension())
->set("MIME_TYPE", $formatter->getMimeType())
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
/**
* Definition of loop arguments
*
* example :
*
* public function getArgDefinitions()
* {
* return new ArgumentCollection(
*
* Argument::createIntListTypeArgument('id'),
* new Argument(
* 'ref',
* new TypeCollection(
* new Type\AlphaNumStringListType()
* )
* ),
* Argument::createIntListTypeArgument('category'),
* Argument::createBooleanTypeArgument('new'),
* ...
* );
* }
*
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createAnyTypeArgument("allowed_formatter"),
new Argument(
"order",
new TypeCollection(
new EnumType(["alpha", "alpha_reverse"])
),
"alpha"
)
);
}
}

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,508 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\ImportExportCategoryI18n as ChildImportExportCategoryI18n;
use Thelia\Model\ImportExportCategoryI18nQuery as ChildImportExportCategoryI18nQuery;
use Thelia\Model\Map\ImportExportCategoryI18nTableMap;
/**
* Base class that represents a query for the 'import_export_category_i18n' table.
*
*
*
* @method ChildImportExportCategoryI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildImportExportCategoryI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildImportExportCategoryI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
*
* @method ChildImportExportCategoryI18nQuery groupById() Group by the id column
* @method ChildImportExportCategoryI18nQuery groupByLocale() Group by the locale column
* @method ChildImportExportCategoryI18nQuery groupByTitle() Group by the title column
*
* @method ChildImportExportCategoryI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildImportExportCategoryI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildImportExportCategoryI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildImportExportCategoryI18nQuery leftJoinImportExportCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportCategory relation
* @method ChildImportExportCategoryI18nQuery rightJoinImportExportCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportCategory relation
* @method ChildImportExportCategoryI18nQuery innerJoinImportExportCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportCategory relation
*
* @method ChildImportExportCategoryI18n findOne(ConnectionInterface $con = null) Return the first ChildImportExportCategoryI18n matching the query
* @method ChildImportExportCategoryI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportExportCategoryI18n matching the query, or a new ChildImportExportCategoryI18n object populated from the query conditions when no match is found
*
* @method ChildImportExportCategoryI18n findOneById(int $id) Return the first ChildImportExportCategoryI18n filtered by the id column
* @method ChildImportExportCategoryI18n findOneByLocale(string $locale) Return the first ChildImportExportCategoryI18n filtered by the locale column
* @method ChildImportExportCategoryI18n findOneByTitle(string $title) Return the first ChildImportExportCategoryI18n filtered by the title column
*
* @method array findById(int $id) Return ChildImportExportCategoryI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildImportExportCategoryI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildImportExportCategoryI18n objects filtered by the title column
*
*/
abstract class ImportExportCategoryI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\ImportExportCategoryI18nQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportExportCategoryI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildImportExportCategoryI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildImportExportCategoryI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\ImportExportCategoryI18nQuery) {
return $criteria;
}
$query = new \Thelia\Model\ImportExportCategoryI18nQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param array[$id, $locale] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildImportExportCategoryI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ImportExportCategoryI18nTableMap::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(ImportExportCategoryI18nTableMap::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 ChildImportExportCategoryI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `LOCALE`, `TITLE` FROM `import_export_category_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildImportExportCategoryI18n();
$obj->hydrate($row);
ImportExportCategoryI18nTableMap::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 ChildImportExportCategoryI18n|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 ChildImportExportCategoryI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(ImportExportCategoryI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildImportExportCategoryI18nQuery 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(ImportExportCategoryI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(ImportExportCategoryI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @see filterByImportExportCategory()
*
* @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 ChildImportExportCategoryI18nQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the locale column
*
* Example usage:
* <code>
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
* </code>
*
* @param string $locale The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildImportExportCategoryI18nQuery The current query, for fluid interface
*/
public function filterByLocale($locale = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($locale)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $locale)) {
$locale = str_replace('*', '%', $locale);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ImportExportCategoryI18nTableMap::LOCALE, $locale, $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 ChildImportExportCategoryI18nQuery 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(ImportExportCategoryI18nTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\ImportExportCategory object
*
* @param \Thelia\Model\ImportExportCategory|ObjectCollection $importExportCategory The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildImportExportCategoryI18nQuery The current query, for fluid interface
*/
public function filterByImportExportCategory($importExportCategory, $comparison = null)
{
if ($importExportCategory instanceof \Thelia\Model\ImportExportCategory) {
return $this
->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $importExportCategory->getId(), $comparison);
} elseif ($importExportCategory instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $importExportCategory->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByImportExportCategory() only accepts arguments of type \Thelia\Model\ImportExportCategory or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ImportExportCategory relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildImportExportCategoryI18nQuery The current query, for fluid interface
*/
public function joinImportExportCategory($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ImportExportCategory');
// 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, 'ImportExportCategory');
}
return $this;
}
/**
* Use the ImportExportCategory relation ImportExportCategory 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\ImportExportCategoryQuery A secondary query class using the current class as primary query
*/
public function useImportExportCategoryQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinImportExportCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ImportExportCategory', '\Thelia\Model\ImportExportCategoryQuery');
}
/**
* Exclude object from result
*
* @param ChildImportExportCategoryI18n $importExportCategoryI18n Object to remove from the list of results
*
* @return ChildImportExportCategoryI18nQuery The current query, for fluid interface
*/
public function prune($importExportCategoryI18n = null)
{
if ($importExportCategoryI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(ImportExportCategoryI18nTableMap::ID), $importExportCategoryI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(ImportExportCategoryI18nTableMap::LOCALE), $importExportCategoryI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the import_export_category_i18n table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryI18nTableMap::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).
ImportExportCategoryI18nTableMap::clearInstancePool();
ImportExportCategoryI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildImportExportCategoryI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildImportExportCategoryI18n 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(ImportExportCategoryI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(ImportExportCategoryI18nTableMap::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();
ImportExportCategoryI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
ImportExportCategoryI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // ImportExportCategoryI18nQuery

View File

@@ -0,0 +1,764 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\ImportExportCategory as ChildImportExportCategory;
use Thelia\Model\ImportExportCategoryI18nQuery as ChildImportExportCategoryI18nQuery;
use Thelia\Model\ImportExportCategoryQuery as ChildImportExportCategoryQuery;
use Thelia\Model\Map\ImportExportCategoryTableMap;
/**
* Base class that represents a query for the 'import_export_category' table.
*
*
*
* @method ChildImportExportCategoryQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildImportExportCategoryQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildImportExportCategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildImportExportCategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildImportExportCategoryQuery groupById() Group by the id column
* @method ChildImportExportCategoryQuery groupByPosition() Group by the position column
* @method ChildImportExportCategoryQuery groupByCreatedAt() Group by the created_at column
* @method ChildImportExportCategoryQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildImportExportCategoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildImportExportCategoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildImportExportCategoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildImportExportCategoryQuery leftJoinImportExportType($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportType relation
* @method ChildImportExportCategoryQuery rightJoinImportExportType($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportType relation
* @method ChildImportExportCategoryQuery innerJoinImportExportType($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportType relation
*
* @method ChildImportExportCategoryQuery leftJoinImportExportCategoryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportCategoryI18n relation
* @method ChildImportExportCategoryQuery rightJoinImportExportCategoryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportCategoryI18n relation
* @method ChildImportExportCategoryQuery innerJoinImportExportCategoryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportCategoryI18n relation
*
* @method ChildImportExportCategory findOne(ConnectionInterface $con = null) Return the first ChildImportExportCategory matching the query
* @method ChildImportExportCategory findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportExportCategory matching the query, or a new ChildImportExportCategory object populated from the query conditions when no match is found
*
* @method ChildImportExportCategory findOneById(int $id) Return the first ChildImportExportCategory filtered by the id column
* @method ChildImportExportCategory findOneByPosition(int $position) Return the first ChildImportExportCategory filtered by the position column
* @method ChildImportExportCategory findOneByCreatedAt(string $created_at) Return the first ChildImportExportCategory filtered by the created_at column
* @method ChildImportExportCategory findOneByUpdatedAt(string $updated_at) Return the first ChildImportExportCategory filtered by the updated_at column
*
* @method array findById(int $id) Return ChildImportExportCategory objects filtered by the id column
* @method array findByPosition(int $position) Return ChildImportExportCategory objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildImportExportCategory objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildImportExportCategory objects filtered by the updated_at column
*
*/
abstract class ImportExportCategoryQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\ImportExportCategoryQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportExportCategory', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildImportExportCategoryQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildImportExportCategoryQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\ImportExportCategoryQuery) {
return $criteria;
}
$query = new \Thelia\Model\ImportExportCategoryQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildImportExportCategory|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ImportExportCategoryTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(ImportExportCategoryTableMap::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 ChildImportExportCategory A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `import_export_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), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildImportExportCategory();
$obj->hydrate($row);
ImportExportCategoryTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildImportExportCategory|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(ImportExportCategoryTableMap::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 ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ImportExportCategoryTableMap::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 ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(ImportExportCategoryTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(ImportExportCategoryTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ImportExportCategoryTableMap::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 ChildImportExportCategoryQuery 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(ImportExportCategoryTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(ImportExportCategoryTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ImportExportCategoryTableMap::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 ChildImportExportCategoryQuery 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(ImportExportCategoryTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(ImportExportCategoryTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ImportExportCategoryTableMap::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 ChildImportExportCategoryQuery 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(ImportExportCategoryTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(ImportExportCategoryTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ImportExportCategoryTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\ImportExportType object
*
* @param \Thelia\Model\ImportExportType|ObjectCollection $importExportType the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function filterByImportExportType($importExportType, $comparison = null)
{
if ($importExportType instanceof \Thelia\Model\ImportExportType) {
return $this
->addUsingAlias(ImportExportCategoryTableMap::ID, $importExportType->getImportExportCategoryId(), $comparison);
} elseif ($importExportType instanceof ObjectCollection) {
return $this
->useImportExportTypeQuery()
->filterByPrimaryKeys($importExportType->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByImportExportType() only accepts arguments of type \Thelia\Model\ImportExportType or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ImportExportType relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function joinImportExportType($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ImportExportType');
// 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, 'ImportExportType');
}
return $this;
}
/**
* Use the ImportExportType relation ImportExportType 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\ImportExportTypeQuery A secondary query class using the current class as primary query
*/
public function useImportExportTypeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinImportExportType($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ImportExportType', '\Thelia\Model\ImportExportTypeQuery');
}
/**
* Filter the query by a related \Thelia\Model\ImportExportCategoryI18n object
*
* @param \Thelia\Model\ImportExportCategoryI18n|ObjectCollection $importExportCategoryI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function filterByImportExportCategoryI18n($importExportCategoryI18n, $comparison = null)
{
if ($importExportCategoryI18n instanceof \Thelia\Model\ImportExportCategoryI18n) {
return $this
->addUsingAlias(ImportExportCategoryTableMap::ID, $importExportCategoryI18n->getId(), $comparison);
} elseif ($importExportCategoryI18n instanceof ObjectCollection) {
return $this
->useImportExportCategoryI18nQuery()
->filterByPrimaryKeys($importExportCategoryI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByImportExportCategoryI18n() only accepts arguments of type \Thelia\Model\ImportExportCategoryI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ImportExportCategoryI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function joinImportExportCategoryI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ImportExportCategoryI18n');
// 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, 'ImportExportCategoryI18n');
}
return $this;
}
/**
* Use the ImportExportCategoryI18n relation ImportExportCategoryI18n 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\ImportExportCategoryI18nQuery A secondary query class using the current class as primary query
*/
public function useImportExportCategoryI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinImportExportCategoryI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ImportExportCategoryI18n', '\Thelia\Model\ImportExportCategoryI18nQuery');
}
/**
* Exclude object from result
*
* @param ChildImportExportCategory $importExportCategory Object to remove from the list of results
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function prune($importExportCategory = null)
{
if ($importExportCategory) {
$this->addUsingAlias(ImportExportCategoryTableMap::ID, $importExportCategory->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the import_export_category 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(ImportExportCategoryTableMap::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).
ImportExportCategoryTableMap::clearInstancePool();
ImportExportCategoryTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildImportExportCategory or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildImportExportCategory 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(ImportExportCategoryTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(ImportExportCategoryTableMap::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();
ImportExportCategoryTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
ImportExportCategoryTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// i18n behavior
/**
* Adds a JOIN clause to the query using the i18n relation
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'ImportExportCategoryI18n';
return $this
->joinImportExportCategoryI18n($relationAlias, $joinType)
->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
}
/**
* Adds a JOIN clause to the query and hydrates the related I18n object.
* Shortcut for $c->joinI18n($locale)->with()
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('ImportExportCategoryI18n');
$this->with['ImportExportCategoryI18n']->setIsWithOneToMany(false);
return $this;
}
/**
* Use the I18n relation query object
*
* @see useQuery()
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildImportExportCategoryI18nQuery A secondary query class using the current class as primary query
*/
public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinI18n($locale, $relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ImportExportCategoryI18n', '\Thelia\Model\ImportExportCategoryI18nQuery');
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(ImportExportCategoryTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(ImportExportCategoryTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(ImportExportCategoryTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(ImportExportCategoryTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(ImportExportCategoryTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildImportExportCategoryQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(ImportExportCategoryTableMap::CREATED_AT);
}
} // ImportExportCategoryQuery

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,541 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\ImportExportTypeI18n as ChildImportExportTypeI18n;
use Thelia\Model\ImportExportTypeI18nQuery as ChildImportExportTypeI18nQuery;
use Thelia\Model\Map\ImportExportTypeI18nTableMap;
/**
* Base class that represents a query for the 'import_export_type_i18n' table.
*
*
*
* @method ChildImportExportTypeI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildImportExportTypeI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildImportExportTypeI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildImportExportTypeI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
*
* @method ChildImportExportTypeI18nQuery groupById() Group by the id column
* @method ChildImportExportTypeI18nQuery groupByLocale() Group by the locale column
* @method ChildImportExportTypeI18nQuery groupByTitle() Group by the title column
* @method ChildImportExportTypeI18nQuery groupByDescription() Group by the description column
*
* @method ChildImportExportTypeI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildImportExportTypeI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildImportExportTypeI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildImportExportTypeI18nQuery leftJoinImportExportType($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportType relation
* @method ChildImportExportTypeI18nQuery rightJoinImportExportType($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportType relation
* @method ChildImportExportTypeI18nQuery innerJoinImportExportType($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportType relation
*
* @method ChildImportExportTypeI18n findOne(ConnectionInterface $con = null) Return the first ChildImportExportTypeI18n matching the query
* @method ChildImportExportTypeI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportExportTypeI18n matching the query, or a new ChildImportExportTypeI18n object populated from the query conditions when no match is found
*
* @method ChildImportExportTypeI18n findOneById(int $id) Return the first ChildImportExportTypeI18n filtered by the id column
* @method ChildImportExportTypeI18n findOneByLocale(string $locale) Return the first ChildImportExportTypeI18n filtered by the locale column
* @method ChildImportExportTypeI18n findOneByTitle(string $title) Return the first ChildImportExportTypeI18n filtered by the title column
* @method ChildImportExportTypeI18n findOneByDescription(string $description) Return the first ChildImportExportTypeI18n filtered by the description column
*
* @method array findById(int $id) Return ChildImportExportTypeI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildImportExportTypeI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildImportExportTypeI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildImportExportTypeI18n objects filtered by the description column
*
*/
abstract class ImportExportTypeI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\ImportExportTypeI18nQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportExportTypeI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildImportExportTypeI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildImportExportTypeI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\ImportExportTypeI18nQuery) {
return $criteria;
}
$query = new \Thelia\Model\ImportExportTypeI18nQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param array[$id, $locale] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildImportExportTypeI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ImportExportTypeI18nTableMap::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(ImportExportTypeI18nTableMap::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 ChildImportExportTypeI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION` FROM `import_export_type_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildImportExportTypeI18n();
$obj->hydrate($row);
ImportExportTypeI18nTableMap::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 ChildImportExportTypeI18n|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 ChildImportExportTypeI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(ImportExportTypeI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(ImportExportTypeI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildImportExportTypeI18nQuery 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(ImportExportTypeI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(ImportExportTypeI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @see filterByImportExportType()
*
* @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 ChildImportExportTypeI18nQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(ImportExportTypeI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(ImportExportTypeI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ImportExportTypeI18nTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the locale column
*
* Example usage:
* <code>
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
* </code>
*
* @param string $locale The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildImportExportTypeI18nQuery The current query, for fluid interface
*/
public function filterByLocale($locale = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($locale)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $locale)) {
$locale = str_replace('*', '%', $locale);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ImportExportTypeI18nTableMap::LOCALE, $locale, $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 ChildImportExportTypeI18nQuery 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(ImportExportTypeI18nTableMap::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 ChildImportExportTypeI18nQuery 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(ImportExportTypeI18nTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\ImportExportType object
*
* @param \Thelia\Model\ImportExportType|ObjectCollection $importExportType The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildImportExportTypeI18nQuery The current query, for fluid interface
*/
public function filterByImportExportType($importExportType, $comparison = null)
{
if ($importExportType instanceof \Thelia\Model\ImportExportType) {
return $this
->addUsingAlias(ImportExportTypeI18nTableMap::ID, $importExportType->getId(), $comparison);
} elseif ($importExportType instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ImportExportTypeI18nTableMap::ID, $importExportType->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByImportExportType() only accepts arguments of type \Thelia\Model\ImportExportType or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ImportExportType relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildImportExportTypeI18nQuery The current query, for fluid interface
*/
public function joinImportExportType($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ImportExportType');
// 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, 'ImportExportType');
}
return $this;
}
/**
* Use the ImportExportType relation ImportExportType 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\ImportExportTypeQuery A secondary query class using the current class as primary query
*/
public function useImportExportTypeQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinImportExportType($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ImportExportType', '\Thelia\Model\ImportExportTypeQuery');
}
/**
* Exclude object from result
*
* @param ChildImportExportTypeI18n $importExportTypeI18n Object to remove from the list of results
*
* @return ChildImportExportTypeI18nQuery The current query, for fluid interface
*/
public function prune($importExportTypeI18n = null)
{
if ($importExportTypeI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(ImportExportTypeI18nTableMap::ID), $importExportTypeI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(ImportExportTypeI18nTableMap::LOCALE), $importExportTypeI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the import_export_type_i18n table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeI18nTableMap::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).
ImportExportTypeI18nTableMap::clearInstancePool();
ImportExportTypeI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildImportExportTypeI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildImportExportTypeI18n 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(ImportExportTypeI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(ImportExportTypeI18nTableMap::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();
ImportExportTypeI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
ImportExportTypeI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // ImportExportTypeI18nQuery

View File

@@ -0,0 +1,641 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\ImportExportType as ChildImportExportType;
use Thelia\Model\ImportExportTypeI18nQuery as ChildImportExportTypeI18nQuery;
use Thelia\Model\ImportExportTypeQuery as ChildImportExportTypeQuery;
use Thelia\Model\Map\ImportExportTypeTableMap;
/**
* Base class that represents a query for the 'import_export_type' table.
*
*
*
* @method ChildImportExportTypeQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildImportExportTypeQuery orderByUrlAction($order = Criteria::ASC) Order by the url_action column
* @method ChildImportExportTypeQuery orderByImportExportCategoryId($order = Criteria::ASC) Order by the import_export_category_id column
*
* @method ChildImportExportTypeQuery groupById() Group by the id column
* @method ChildImportExportTypeQuery groupByUrlAction() Group by the url_action column
* @method ChildImportExportTypeQuery groupByImportExportCategoryId() Group by the import_export_category_id column
*
* @method ChildImportExportTypeQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildImportExportTypeQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildImportExportTypeQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildImportExportTypeQuery leftJoinImportExportCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportCategory relation
* @method ChildImportExportTypeQuery rightJoinImportExportCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportCategory relation
* @method ChildImportExportTypeQuery innerJoinImportExportCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportCategory relation
*
* @method ChildImportExportTypeQuery leftJoinImportExportTypeI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportTypeI18n relation
* @method ChildImportExportTypeQuery rightJoinImportExportTypeI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportTypeI18n relation
* @method ChildImportExportTypeQuery innerJoinImportExportTypeI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportTypeI18n relation
*
* @method ChildImportExportType findOne(ConnectionInterface $con = null) Return the first ChildImportExportType matching the query
* @method ChildImportExportType findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportExportType matching the query, or a new ChildImportExportType object populated from the query conditions when no match is found
*
* @method ChildImportExportType findOneById(int $id) Return the first ChildImportExportType filtered by the id column
* @method ChildImportExportType findOneByUrlAction(string $url_action) Return the first ChildImportExportType filtered by the url_action column
* @method ChildImportExportType findOneByImportExportCategoryId(int $import_export_category_id) Return the first ChildImportExportType filtered by the import_export_category_id column
*
* @method array findById(int $id) Return ChildImportExportType objects filtered by the id column
* @method array findByUrlAction(string $url_action) Return ChildImportExportType objects filtered by the url_action column
* @method array findByImportExportCategoryId(int $import_export_category_id) Return ChildImportExportType objects filtered by the import_export_category_id column
*
*/
abstract class ImportExportTypeQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\ImportExportTypeQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportExportType', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildImportExportTypeQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildImportExportTypeQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\ImportExportTypeQuery) {
return $criteria;
}
$query = new \Thelia\Model\ImportExportTypeQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildImportExportType|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ImportExportTypeTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(ImportExportTypeTableMap::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 ChildImportExportType A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `URL_ACTION`, `IMPORT_EXPORT_CATEGORY_ID` FROM `import_export_type` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildImportExportType();
$obj->hydrate($row);
ImportExportTypeTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildImportExportType|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(ImportExportTypeTableMap::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 ChildImportExportTypeQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ImportExportTypeTableMap::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 ChildImportExportTypeQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(ImportExportTypeTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(ImportExportTypeTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ImportExportTypeTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the url_action column
*
* Example usage:
* <code>
* $query->filterByUrlAction('fooValue'); // WHERE url_action = 'fooValue'
* $query->filterByUrlAction('%fooValue%'); // WHERE url_action LIKE '%fooValue%'
* </code>
*
* @param string $urlAction 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 ChildImportExportTypeQuery The current query, for fluid interface
*/
public function filterByUrlAction($urlAction = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($urlAction)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $urlAction)) {
$urlAction = str_replace('*', '%', $urlAction);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ImportExportTypeTableMap::URL_ACTION, $urlAction, $comparison);
}
/**
* Filter the query on the import_export_category_id column
*
* Example usage:
* <code>
* $query->filterByImportExportCategoryId(1234); // WHERE import_export_category_id = 1234
* $query->filterByImportExportCategoryId(array(12, 34)); // WHERE import_export_category_id IN (12, 34)
* $query->filterByImportExportCategoryId(array('min' => 12)); // WHERE import_export_category_id > 12
* </code>
*
* @see filterByImportExportCategory()
*
* @param mixed $importExportCategoryId 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 ChildImportExportTypeQuery The current query, for fluid interface
*/
public function filterByImportExportCategoryId($importExportCategoryId = null, $comparison = null)
{
if (is_array($importExportCategoryId)) {
$useMinMax = false;
if (isset($importExportCategoryId['min'])) {
$this->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategoryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($importExportCategoryId['max'])) {
$this->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategoryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategoryId, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\ImportExportCategory object
*
* @param \Thelia\Model\ImportExportCategory|ObjectCollection $importExportCategory The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function filterByImportExportCategory($importExportCategory, $comparison = null)
{
if ($importExportCategory instanceof \Thelia\Model\ImportExportCategory) {
return $this
->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategory->getId(), $comparison);
} elseif ($importExportCategory instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategory->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByImportExportCategory() only accepts arguments of type \Thelia\Model\ImportExportCategory or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ImportExportCategory relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function joinImportExportCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ImportExportCategory');
// 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, 'ImportExportCategory');
}
return $this;
}
/**
* Use the ImportExportCategory relation ImportExportCategory 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\ImportExportCategoryQuery A secondary query class using the current class as primary query
*/
public function useImportExportCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinImportExportCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ImportExportCategory', '\Thelia\Model\ImportExportCategoryQuery');
}
/**
* Filter the query by a related \Thelia\Model\ImportExportTypeI18n object
*
* @param \Thelia\Model\ImportExportTypeI18n|ObjectCollection $importExportTypeI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function filterByImportExportTypeI18n($importExportTypeI18n, $comparison = null)
{
if ($importExportTypeI18n instanceof \Thelia\Model\ImportExportTypeI18n) {
return $this
->addUsingAlias(ImportExportTypeTableMap::ID, $importExportTypeI18n->getId(), $comparison);
} elseif ($importExportTypeI18n instanceof ObjectCollection) {
return $this
->useImportExportTypeI18nQuery()
->filterByPrimaryKeys($importExportTypeI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByImportExportTypeI18n() only accepts arguments of type \Thelia\Model\ImportExportTypeI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the ImportExportTypeI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function joinImportExportTypeI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('ImportExportTypeI18n');
// 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, 'ImportExportTypeI18n');
}
return $this;
}
/**
* Use the ImportExportTypeI18n relation ImportExportTypeI18n 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\ImportExportTypeI18nQuery A secondary query class using the current class as primary query
*/
public function useImportExportTypeI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinImportExportTypeI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ImportExportTypeI18n', '\Thelia\Model\ImportExportTypeI18nQuery');
}
/**
* Exclude object from result
*
* @param ChildImportExportType $importExportType Object to remove from the list of results
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function prune($importExportType = null)
{
if ($importExportType) {
$this->addUsingAlias(ImportExportTypeTableMap::ID, $importExportType->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the import_export_type 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(ImportExportTypeTableMap::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).
ImportExportTypeTableMap::clearInstancePool();
ImportExportTypeTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildImportExportType or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildImportExportType 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(ImportExportTypeTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(ImportExportTypeTableMap::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();
ImportExportTypeTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
ImportExportTypeTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// i18n behavior
/**
* Adds a JOIN clause to the query using the i18n relation
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'ImportExportTypeI18n';
return $this
->joinImportExportTypeI18n($relationAlias, $joinType)
->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
}
/**
* Adds a JOIN clause to the query and hydrates the related I18n object.
* Shortcut for $c->joinI18n($locale)->with()
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('ImportExportTypeI18n');
$this->with['ImportExportTypeI18n']->setIsWithOneToMany(false);
return $this;
}
/**
* Use the I18n relation query object
*
* @see useQuery()
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildImportExportTypeI18nQuery A secondary query class using the current class as primary query
*/
public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinI18n($locale, $relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ImportExportTypeI18n', '\Thelia\Model\ImportExportTypeI18nQuery');
}
} // ImportExportTypeQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\ImportExportCategory as BaseImportExportCategory;
class ImportExportCategory extends BaseImportExportCategory
{
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\ImportExportCategoryI18n as BaseImportExportCategoryI18n;
class ImportExportCategoryI18n extends BaseImportExportCategoryI18n
{
}

View File

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

View File

@@ -0,0 +1,21 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\ImportExportCategoryQuery as BaseImportExportCategoryQuery;
/**
* Skeleton subclass for performing query and update operations on the 'import_export_category' 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 ImportExportCategoryQuery extends BaseImportExportCategoryQuery
{
} // ImportExportCategoryQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\ImportExportType as BaseImportExportType;
class ImportExportType extends BaseImportExportType
{
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\ImportExportTypeI18n as BaseImportExportTypeI18n;
class ImportExportTypeI18n extends BaseImportExportTypeI18n
{
}

View File

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

View File

@@ -0,0 +1,21 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\ImportExportTypeQuery as BaseImportExportTypeQuery;
/**
* Skeleton subclass for performing query and update operations on the 'import_export_type' 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 ImportExportTypeQuery extends BaseImportExportTypeQuery
{
} // ImportExportTypeQuery

View File

@@ -0,0 +1,474 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\ImportExportCategoryI18n;
use Thelia\Model\ImportExportCategoryI18nQuery;
/**
* This class defines the structure of the 'import_export_category_i18n' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
*/
class ImportExportCategoryI18nTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.ImportExportCategoryI18nTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'import_export_category_i18n';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\ImportExportCategoryI18n';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.ImportExportCategoryI18n';
/**
* 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 ID field
*/
const ID = 'import_export_category_i18n.ID';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'import_export_category_i18n.LOCALE';
/**
* the column name for the TITLE field
*/
const TITLE = 'import_export_category_i18n.TITLE';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', ),
self::TYPE_COLNAME => array(ImportExportCategoryI18nTableMap::ID, ImportExportCategoryI18nTableMap::LOCALE, ImportExportCategoryI18nTableMap::TITLE, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', ),
self::TYPE_FIELDNAME => array('id', 'locale', 'title', ),
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('Id' => 0, 'Locale' => 1, 'Title' => 2, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, ),
self::TYPE_COLNAME => array(ImportExportCategoryI18nTableMap::ID => 0, ImportExportCategoryI18nTableMap::LOCALE => 1, ImportExportCategoryI18nTableMap::TITLE => 2, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 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('import_export_category_i18n');
$this->setPhpName('ImportExportCategoryI18n');
$this->setClassName('\\Thelia\\Model\\ImportExportCategoryI18n');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'import_export_category', 'ID', true, null, null);
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('ImportExportCategory', '\\Thelia\\Model\\ImportExportCategory', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
} // buildRelations()
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by find*()
* and findPk*() calls.
*
* @param \Thelia\Model\ImportExportCategoryI18n $obj A \Thelia\Model\ImportExportCategoryI18n object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if (null === $key) {
$key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
} // if key === null
self::$instances[$key] = $obj;
}
}
/**
* Removes an object from the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doDelete
* methods in your stub classes -- you may need to explicitly remove objects
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A \Thelia\Model\ImportExportCategoryI18n object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Thelia\Model\ImportExportCategoryI18n) {
$key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
} elseif (is_array($value) && count($value) === 2) {
// assume we've been passed a primary key";
$key = serialize(array((string) $value[0], (string) $value[1]));
} elseif ($value instanceof Criteria) {
self::$instances = [];
return;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\ImportExportCategoryI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
throw $e;
}
unset(self::$instances[$key]);
}
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]));
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return $pks;
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? ImportExportCategoryI18nTableMap::CLASS_DEFAULT : ImportExportCategoryI18nTableMap::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 (ImportExportCategoryI18n object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = ImportExportCategoryI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = ImportExportCategoryI18nTableMap::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 + ImportExportCategoryI18nTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = ImportExportCategoryI18nTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
ImportExportCategoryI18nTableMap::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 = ImportExportCategoryI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = ImportExportCategoryI18nTableMap::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;
ImportExportCategoryI18nTableMap::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(ImportExportCategoryI18nTableMap::ID);
$criteria->addSelectColumn(ImportExportCategoryI18nTableMap::LOCALE);
$criteria->addSelectColumn(ImportExportCategoryI18nTableMap::TITLE);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.TITLE');
}
}
/**
* 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(ImportExportCategoryI18nTableMap::DATABASE_NAME)->getTable(ImportExportCategoryI18nTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportExportCategoryI18nTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(ImportExportCategoryI18nTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new ImportExportCategoryI18nTableMap());
}
}
/**
* Performs a DELETE on the database, given a ImportExportCategoryI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ImportExportCategoryI18n 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(ImportExportCategoryI18nTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\ImportExportCategoryI18n) { // 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(ImportExportCategoryI18nTableMap::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(ImportExportCategoryI18nTableMap::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(ImportExportCategoryI18nTableMap::LOCALE, $value[1]));
$criteria->addOr($criterion);
}
}
$query = ImportExportCategoryI18nQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { ImportExportCategoryI18nTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { ImportExportCategoryI18nTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the import_export_category_i18n table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll(ConnectionInterface $con = null)
{
return ImportExportCategoryI18nQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a ImportExportCategoryI18n or Criteria object.
*
* @param mixed $criteria Criteria or ImportExportCategoryI18n 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(ImportExportCategoryI18nTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from ImportExportCategoryI18n object
}
// Set the correct dbName
$query = ImportExportCategoryI18nQuery::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;
}
} // ImportExportCategoryI18nTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
ImportExportCategoryI18nTableMap::buildTableMap();

View File

@@ -0,0 +1,461 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\ImportExportCategory;
use Thelia\Model\ImportExportCategoryQuery;
/**
* This class defines the structure of the 'import_export_category' 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 ImportExportCategoryTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.ImportExportCategoryTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'import_export_category';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\ImportExportCategory';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.ImportExportCategory';
/**
* 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 = 'import_export_category.ID';
/**
* the column name for the POSITION field
*/
const POSITION = 'import_export_category.POSITION';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'import_export_category.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'import_export_category.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
// i18n behavior
/**
* The default locale to use for translations.
*
* @var string
*/
const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ImportExportCategoryTableMap::ID, ImportExportCategoryTableMap::POSITION, ImportExportCategoryTableMap::CREATED_AT, ImportExportCategoryTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'position', 'created_at', 'updated_at', ),
self::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. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Position' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'position' => 1, 'createdAt' => 2, 'updatedAt' => 3, ),
self::TYPE_COLNAME => array(ImportExportCategoryTableMap::ID => 0, ImportExportCategoryTableMap::POSITION => 1, ImportExportCategoryTableMap::CREATED_AT => 2, ImportExportCategoryTableMap::UPDATED_AT => 3, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'POSITION' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ),
self::TYPE_FIELDNAME => array('id' => 0, 'position' => 1, 'created_at' => 2, 'updated_at' => 3, ),
self::TYPE_NUM => array(0, 1, 2, 3, )
);
/**
* 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('import_export_category');
$this->setPhpName('ImportExportCategory');
$this->setClassName('\\Thelia\\Model\\ImportExportCategory');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('ImportExportType', '\\Thelia\\Model\\ImportExportType', RelationMap::ONE_TO_MANY, array('id' => 'import_export_category_id', ), 'CASCADE', 'RESTRICT', 'ImportExportTypes');
$this->addRelation('ImportExportCategoryI18n', '\\Thelia\\Model\\ImportExportCategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ImportExportCategoryI18ns');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* Method to invalidate the instance pool of all tables related to import_export_category * by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ImportExportTypeTableMap::clearInstancePool();
ImportExportCategoryI18nTableMap::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 resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? ImportExportCategoryTableMap::CLASS_DEFAULT : ImportExportCategoryTableMap::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 (ImportExportCategory object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = ImportExportCategoryTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = ImportExportCategoryTableMap::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 + ImportExportCategoryTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = ImportExportCategoryTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
ImportExportCategoryTableMap::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 = ImportExportCategoryTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = ImportExportCategoryTableMap::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;
ImportExportCategoryTableMap::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(ImportExportCategoryTableMap::ID);
$criteria->addSelectColumn(ImportExportCategoryTableMap::POSITION);
$criteria->addSelectColumn(ImportExportCategoryTableMap::CREATED_AT);
$criteria->addSelectColumn(ImportExportCategoryTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the TableMap related to this object.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getServiceContainer()->getDatabaseMap(ImportExportCategoryTableMap::DATABASE_NAME)->getTable(ImportExportCategoryTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportExportCategoryTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(ImportExportCategoryTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new ImportExportCategoryTableMap());
}
}
/**
* Performs a DELETE on the database, given a ImportExportCategory or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ImportExportCategory 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(ImportExportCategoryTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\ImportExportCategory) { // 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(ImportExportCategoryTableMap::DATABASE_NAME);
$criteria->add(ImportExportCategoryTableMap::ID, (array) $values, Criteria::IN);
}
$query = ImportExportCategoryQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { ImportExportCategoryTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { ImportExportCategoryTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the import_export_category 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 ImportExportCategoryQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a ImportExportCategory or Criteria object.
*
* @param mixed $criteria Criteria or ImportExportCategory 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(ImportExportCategoryTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from ImportExportCategory object
}
if ($criteria->containsKey(ImportExportCategoryTableMap::ID) && $criteria->keyContainsValue(ImportExportCategoryTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImportExportCategoryTableMap::ID.')');
}
// Set the correct dbName
$query = ImportExportCategoryQuery::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;
}
} // ImportExportCategoryTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
ImportExportCategoryTableMap::buildTableMap();

View File

@@ -0,0 +1,482 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\ImportExportTypeI18n;
use Thelia\Model\ImportExportTypeI18nQuery;
/**
* This class defines the structure of the 'import_export_type_i18n' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
*/
class ImportExportTypeI18nTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.ImportExportTypeI18nTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'import_export_type_i18n';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\ImportExportTypeI18n';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.ImportExportTypeI18n';
/**
* 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 = 'import_export_type_i18n.ID';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'import_export_type_i18n.LOCALE';
/**
* the column name for the TITLE field
*/
const TITLE = 'import_export_type_i18n.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'import_export_type_i18n.DESCRIPTION';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', ),
self::TYPE_COLNAME => array(ImportExportTypeI18nTableMap::ID, ImportExportTypeI18nTableMap::LOCALE, ImportExportTypeI18nTableMap::TITLE, ImportExportTypeI18nTableMap::DESCRIPTION, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', ),
self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', ),
self::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. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ),
self::TYPE_COLNAME => array(ImportExportTypeI18nTableMap::ID => 0, ImportExportTypeI18nTableMap::LOCALE => 1, ImportExportTypeI18nTableMap::TITLE => 2, ImportExportTypeI18nTableMap::DESCRIPTION => 3, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ),
self::TYPE_NUM => array(0, 1, 2, 3, )
);
/**
* 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('import_export_type_i18n');
$this->setPhpName('ImportExportTypeI18n');
$this->setClassName('\\Thelia\\Model\\ImportExportTypeI18n');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'import_export_type', 'ID', true, null, null);
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('ImportExportType', '\\Thelia\\Model\\ImportExportType', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
} // buildRelations()
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by find*()
* and findPk*() calls.
*
* @param \Thelia\Model\ImportExportTypeI18n $obj A \Thelia\Model\ImportExportTypeI18n object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if (null === $key) {
$key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
} // if key === null
self::$instances[$key] = $obj;
}
}
/**
* Removes an object from the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doDelete
* methods in your stub classes -- you may need to explicitly remove objects
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A \Thelia\Model\ImportExportTypeI18n object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Thelia\Model\ImportExportTypeI18n) {
$key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
} elseif (is_array($value) && count($value) === 2) {
// assume we've been passed a primary key";
$key = serialize(array((string) $value[0], (string) $value[1]));
} elseif ($value instanceof Criteria) {
self::$instances = [];
return;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\ImportExportTypeI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
throw $e;
}
unset(self::$instances[$key]);
}
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]));
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return $pks;
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? ImportExportTypeI18nTableMap::CLASS_DEFAULT : ImportExportTypeI18nTableMap::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 (ImportExportTypeI18n object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = ImportExportTypeI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = ImportExportTypeI18nTableMap::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 + ImportExportTypeI18nTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = ImportExportTypeI18nTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
ImportExportTypeI18nTableMap::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 = ImportExportTypeI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = ImportExportTypeI18nTableMap::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;
ImportExportTypeI18nTableMap::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(ImportExportTypeI18nTableMap::ID);
$criteria->addSelectColumn(ImportExportTypeI18nTableMap::LOCALE);
$criteria->addSelectColumn(ImportExportTypeI18nTableMap::TITLE);
$criteria->addSelectColumn(ImportExportTypeI18nTableMap::DESCRIPTION);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
}
}
/**
* 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(ImportExportTypeI18nTableMap::DATABASE_NAME)->getTable(ImportExportTypeI18nTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportExportTypeI18nTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(ImportExportTypeI18nTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new ImportExportTypeI18nTableMap());
}
}
/**
* Performs a DELETE on the database, given a ImportExportTypeI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ImportExportTypeI18n 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(ImportExportTypeI18nTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\ImportExportTypeI18n) { // 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(ImportExportTypeI18nTableMap::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(ImportExportTypeI18nTableMap::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(ImportExportTypeI18nTableMap::LOCALE, $value[1]));
$criteria->addOr($criterion);
}
}
$query = ImportExportTypeI18nQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { ImportExportTypeI18nTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { ImportExportTypeI18nTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the import_export_type_i18n table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll(ConnectionInterface $con = null)
{
return ImportExportTypeI18nQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a ImportExportTypeI18n or Criteria object.
*
* @param mixed $criteria Criteria or ImportExportTypeI18n 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(ImportExportTypeI18nTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from ImportExportTypeI18n object
}
// Set the correct dbName
$query = ImportExportTypeI18nQuery::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;
}
} // ImportExportTypeI18nTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
ImportExportTypeI18nTableMap::buildTableMap();

View File

@@ -0,0 +1,451 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\ImportExportType;
use Thelia\Model\ImportExportTypeQuery;
/**
* This class defines the structure of the 'import_export_type' 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 ImportExportTypeTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.ImportExportTypeTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'import_export_type';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\ImportExportType';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.ImportExportType';
/**
* 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 ID field
*/
const ID = 'import_export_type.ID';
/**
* the column name for the URL_ACTION field
*/
const URL_ACTION = 'import_export_type.URL_ACTION';
/**
* the column name for the IMPORT_EXPORT_CATEGORY_ID field
*/
const IMPORT_EXPORT_CATEGORY_ID = 'import_export_type.IMPORT_EXPORT_CATEGORY_ID';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
// i18n behavior
/**
* The default locale to use for translations.
*
* @var string
*/
const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'UrlAction', 'ImportExportCategoryId', ),
self::TYPE_STUDLYPHPNAME => array('id', 'urlAction', 'importExportCategoryId', ),
self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID, ImportExportTypeTableMap::URL_ACTION, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, ),
self::TYPE_RAW_COLNAME => array('ID', 'URL_ACTION', 'IMPORT_EXPORT_CATEGORY_ID', ),
self::TYPE_FIELDNAME => array('id', 'url_action', 'import_export_category_id', ),
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('Id' => 0, 'UrlAction' => 1, 'ImportExportCategoryId' => 2, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'urlAction' => 1, 'importExportCategoryId' => 2, ),
self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID => 0, ImportExportTypeTableMap::URL_ACTION => 1, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID => 2, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'URL_ACTION' => 1, 'IMPORT_EXPORT_CATEGORY_ID' => 2, ),
self::TYPE_FIELDNAME => array('id' => 0, 'url_action' => 1, 'import_export_category_id' => 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('import_export_type');
$this->setPhpName('ImportExportType');
$this->setClassName('\\Thelia\\Model\\ImportExportType');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('URL_ACTION', 'UrlAction', 'VARCHAR', true, 255, null);
$this->addForeignKey('IMPORT_EXPORT_CATEGORY_ID', 'ImportExportCategoryId', 'INTEGER', 'import_export_category', 'ID', true, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('ImportExportCategory', '\\Thelia\\Model\\ImportExportCategory', RelationMap::MANY_TO_ONE, array('import_export_category_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('ImportExportTypeI18n', '\\Thelia\\Model\\ImportExportTypeI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ImportExportTypeI18ns');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
/**
* Method to invalidate the instance pool of all tables related to import_export_type * by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ImportExportTypeI18nTableMap::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 resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? ImportExportTypeTableMap::CLASS_DEFAULT : ImportExportTypeTableMap::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 (ImportExportType object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = ImportExportTypeTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = ImportExportTypeTableMap::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 + ImportExportTypeTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = ImportExportTypeTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
ImportExportTypeTableMap::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 = ImportExportTypeTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = ImportExportTypeTableMap::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;
ImportExportTypeTableMap::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(ImportExportTypeTableMap::ID);
$criteria->addSelectColumn(ImportExportTypeTableMap::URL_ACTION);
$criteria->addSelectColumn(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.URL_ACTION');
$criteria->addSelectColumn($alias . '.IMPORT_EXPORT_CATEGORY_ID');
}
}
/**
* 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(ImportExportTypeTableMap::DATABASE_NAME)->getTable(ImportExportTypeTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportExportTypeTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(ImportExportTypeTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new ImportExportTypeTableMap());
}
}
/**
* Performs a DELETE on the database, given a ImportExportType or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ImportExportType 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(ImportExportTypeTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\ImportExportType) { // 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(ImportExportTypeTableMap::DATABASE_NAME);
$criteria->add(ImportExportTypeTableMap::ID, (array) $values, Criteria::IN);
}
$query = ImportExportTypeQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { ImportExportTypeTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { ImportExportTypeTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the import_export_type 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 ImportExportTypeQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a ImportExportType or Criteria object.
*
* @param mixed $criteria Criteria or ImportExportType 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(ImportExportTypeTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from ImportExportType object
}
if ($criteria->containsKey(ImportExportTypeTableMap::ID) && $criteria->keyContainsValue(ImportExportTypeTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImportExportTypeTableMap::ID.')');
}
// Set the correct dbName
$query = ImportExportTypeQuery::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;
}
} // ImportExportTypeTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
ImportExportTypeTableMap::buildTableMap();

View File

@@ -1512,4 +1512,29 @@
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
<table name="import_export_category" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="title" type="VARCHAR" size="255" required="true" />
<column name="position" type="INTEGER" required="true" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title" />
</behavior>
<behavior name="timestampable" />
</table>
<table name="import_export_type" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="title" type="VARCHAR" size="255" required="true" />
<column name="description" type="CLOB" />
<column name="url_action" type="VARCHAR" size="255" required="true" />
<column name="import_export_category_id" type="INTEGER" required="true" />
<foreign-key foreignTable="import_export_category" name="fk_import_export_type_import_export_category_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="import_export_category_id" />
</foreign-key>
<index name="idx_import_export_type_import_export_category_id">
<index-column name="import_export_category_id" />
</index>
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description" />
</behavior>
</table>
</database> </database>

View File

@@ -1873,6 +1873,41 @@ CREATE TABLE `form_firewall`
INDEX `idx_form_firewall_ip_address` (`ip_address`) INDEX `idx_form_firewall_ip_address` (`ip_address`)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- import_export_category
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `import_export_category`;
CREATE TABLE `import_export_category`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`position` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- import_export_type
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `import_export_type`;
CREATE TABLE `import_export_type`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`url_action` VARCHAR(255) NOT NULL,
`import_export_category_id` INTEGER NOT NULL,
PRIMARY KEY (`id`),
INDEX `idx_import_export_type_import_export_category_id` (`import_export_category_id`),
CONSTRAINT `fk_import_export_type_import_export_category_id`
FOREIGN KEY (`import_export_category_id`)
REFERENCES `import_export_category` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- category_i18n -- category_i18n
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@@ -2568,6 +2603,43 @@ CREATE TABLE `brand_image_i18n`
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- import_export_category_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `import_export_category_i18n`;
CREATE TABLE `import_export_category_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `import_export_category_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `import_export_category` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- import_export_type_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `import_export_type_i18n`;
CREATE TABLE `import_export_type_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255) NOT NULL,
`description` LONGTEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `import_export_type_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `import_export_type` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- category_version -- category_version
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------

View File

@@ -10,6 +10,9 @@
{block name="check-access"}view{/block} {block name="check-access"}view{/block}
{block name="main-content"} {block name="main-content"}
{form name="thelia.admin.export"}
<form id="export-form" method="post" {form_enctype form=$form} class="clearfix">
<div class="configuration"> <div class="configuration">
<div id="wrapper" class="container"> <div id="wrapper" class="container">
@@ -24,6 +27,7 @@
{module_include location='tools_top'} {module_include location='tools_top'}
{include file='includes/export-form-definition.html' form=$form}
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
@@ -37,7 +41,6 @@
{loop name="auth-export" type="auth" role="ADMIN" resource="admin.export.customer.newsletter" access="VIEW"} {loop name="auth-export" type="auth" role="ADMIN" resource="admin.export.customer.newsletter" access="VIEW"}
<tr> <tr>
<td><a href="{url path='/admin/export/customer/newsletter'}">{intl l="newsletter subscribers"}</a></td> <td><a href="{url path='/admin/export/customer/newsletter'}">{intl l="newsletter subscribers"}</a></td>
<td><a class="btn btn-default btn-xs" href="{url path='/admin/export/customer/newsletter'}"><i class="glyphicon glyphicon-edit"></i></a></td>
</tr> </tr>
{/loop} {/loop}
@@ -51,8 +54,41 @@
</div> </div>
</div> </div>
</div> </div>
</form>
{/form}
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{/block} {/block}
{block name="javascript-last-call"} {block name="javascript-last-call"}
<!-- -->
<script>
$(document).ready(function() {
var compression_switch = $(".export-compression-switch");
var compression_row = $(".export-compression-selection-row");
compression_switch.on("switch-change", function(e, data) {
var is_checked = data.value;
if (is_checked) {
compression_row.show();
} else {
compression_row.hide();
}
});
if ($("input[type=checkbox]", compression_switch).is(":checked")) {
compression_row.show();
} else {
compression_row.hide();
}
});
</script>
{module_include location='configuration-js'} {module_include location='configuration-js'}
{/block} {/block}

View File

@@ -0,0 +1,96 @@
{*
This file defines the fields used for export configuration:
- Export format
- With images ? documents ?
- archive format ?
*}
<div class="row">
<div class="col-md-12">
<div class="general-block-decorator">
<div class="title block-title">
{intl l="Export options"}
</div>
<div class="block-content">
{ifloop rel="export-formatters"}
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
{custom_render_form_field form=$form field="formatter"}
<select>
{loop name="export-formatters" type="formatter"}
<option value="{$NAME}" {if $value == $NAME}selected{/if}>
{$NAME} (.{$EXTENSION})
</option>
{/loop}
</select>
{/custom_render_form_field}
</div>
<div class="col-md-3">
<div class="row">
<div class="col-md-12">
<label>
{intl l="Do compress"}
</label>
<div data-off-label="&lt;i class='glyphicon glyphicon-remove-circle'&gt;&lt;/i&gt;" data-on-label="&lt;i class='glyphicon glyphicon-ok-circle'&gt;&lt;/i&gt;" data-on="success" class="make-switch switch-small export-compression-switch">
<input type="checkbox" />
</div>
</div>
</div>
<div class="row export-compression-selection-row">
<div class="col-md-12">
{custom_render_form_field form=$form field="archive_builder"}
<select name="{$name}">
{loop name="export-archive-builder" type="archive-builder"}
<option value="{$NAME}" {if $value == $NAME}selected{/if}>
{$NAME} (.{$EXTENSION})
</option>
{/loop}
</select>
{/custom_render_form_field}
</div>
</div>
</div>
<div class="col-md-3">
{form_field form=$form field="images"}
<label for="{$label_attr.for}">
{$label}
</label>
<div data-off-label="&lt;i class='glyphicon glyphicon-remove-circle'&gt;&lt;/i&gt;" data-on-label="&lt;i class='glyphicon glyphicon-ok-circle'&gt;&lt;/i&gt;" data-on="success" class="make-switch switch-small ">
<input type="checkbox" name="{$name}" id="{$label_attr.for}"/>
</div>
{/form_field}
</div>
<div class="col-md-3">
{form_field form=$form field="documents"}
<label for="{$label_attr.for}">
{$label}
</label>
<div data-off-label="&lt;i class='glyphicon glyphicon-remove-circle'&gt;&lt;/i&gt;" data-on-label="&lt;i class='glyphicon glyphicon-ok-circle'&gt;&lt;/i&gt;" data-on="success" class="make-switch switch-small ">
<input type="checkbox" name="{$name}" id="{$label_attr.for}"/>
</div>
{/form_field}
</div>
</div>
</div>
</div>
{/ifloop}
{elseloop rel="export-formatters"}
<div class="row">
<div class="col-md-12">
<div class="alert alert-warning">
{intl l="You can't do exports, you don't have any formatter"}
</div>
</div>
</div>
{/elseloop}
</div>
</div>
</div>