On continue à adapter le template...

This commit is contained in:
2021-04-16 19:23:51 +02:00
parent 1e2e612349
commit c160eb2141
127 changed files with 42260 additions and 36 deletions

View File

@@ -189,7 +189,7 @@
<div class="row">
<div class="col-md-12">
<div id="map" class="locationMap"></div>
<script src="https://maps.googleapis.com/maps/api/js?key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}" async></script>
<script src="https://maps.googleapis.com/maps/api/js?key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}"></script>
</div>
</div>

View File

@@ -5,6 +5,7 @@
function initMap() {
var opt = {
center: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
zoom: 15,
@@ -33,6 +34,7 @@
marker = new google.maps.Marker({
position: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
map: map,
draggable: true,
title: $(document.getElementById("title")).val()
});
}
@@ -52,7 +54,8 @@
resultsMap.setCenter(results[0].geometry.location);
marker = new google.maps.Marker({
map: resultsMap,
position: results[0].geometry.location
position: results[0].geometry.location,
draggable: true
});
$("#latitude").val(results[0].geometry.location.lat);
$("#longitude").val(results[0].geometry.location.lng);
@@ -75,7 +78,7 @@
if (typeof(google) !== 'undefined') {
if (typeof initMap === "function")
initMap();
}
}
});
</script>

View File

@@ -30,7 +30,8 @@ class DigressiveLoop extends BaseI18nLoop implements PropelSearchLoopInterface
{
return new ArgumentCollection(
Argument::createIntTypeArgument('product_id'),
Argument::createIntTypeArgument('quantity')
Argument::createIntTypeArgument('quantity'),
Argument::createBooleanTypeArgument('order')
);
}
@@ -50,6 +51,19 @@ class DigressiveLoop extends BaseI18nLoop implements PropelSearchLoopInterface
;
}
// TheCoreDev : rajout d'un tri sur la quantité
$order = $this->getOrder();
if (!is_null($order)) {
switch ($order) {
case true :
$search->orderByQuantityFrom();
break;
case false :
$search->orderByQuantityFrom(Criteria::DESC);
break;
}
}
return $search;
}

View File

@@ -185,7 +185,7 @@
<div class="row">
<div class="col-md-12">
<div id="map" class="locationMap"></div>
<script src="https://maps.googleapis.com/maps/api/js?key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}" async></script>
<script src="https://maps.googleapis.com/maps/api/js?key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}"></script>
</div>
</div>

View File

@@ -7,7 +7,7 @@
<title>Esay way to display a recipe using Thelia's content feature</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Permet de mettre ne page facilement une recette de cuisine via les contenus Thelia</title>
<title>Permet de mettre en page facilement une recette de cuisine via les contenus Thelia</title>
</descriptive>
<languages>
<language>en_US</language>

View File

@@ -0,0 +1,275 @@
<?php
namespace Selection\Action;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Propel;
use Selection\Event\SelectionEvent;
use Selection\Event\SelectionEvents;
use Selection\Model\Map\SelectionTableMap;
use Selection\Model\Selection;
use Selection\Model\SelectionContainerAssociatedSelection;
use Selection\Model\SelectionContainerAssociatedSelectionQuery;
use Selection\Model\SelectionQuery;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Action\BaseAction;
use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Core\Event\UpdatePositionEvent;
use Selection\Model\Base\SelectionProductQuery;
use Thelia\Log\Tlog;
use Thelia\Model\ConfigQuery;
use Thelia\Model\RewritingUrlQuery;
class SelectionAction extends BaseAction implements EventSubscriberInterface
{
/** @var EventDispatcherInterface */
protected $eventDispatcher;
/**
* @param SelectionEvent $event
* @throws \Exception
*/
public function create(SelectionEvent $event)
{
$this->createOrUpdate($event, new Selection());
}
/**
* @param SelectionEvent $event
* @throws \Exception
*/
public function update(SelectionEvent $event)
{
$model = $this->getSelection($event);
$this->createOrUpdate($event, $model);
}
/**
* @param UpdateSeoEvent $event
* @param $eventName
* @param EventDispatcherInterface $dispatcher
* @return mixed
*/
public function updateSeo(
UpdateSeoEvent $event,
/** @noinspection PhpUnusedParameterInspection */
$eventName,
EventDispatcherInterface $dispatcher
) {
return $this->genericUpdateSeo(SelectionQuery::create(), $event, $dispatcher);
}
/**
* {@inheritDoc}
*/
public function getRewrittenUrlViewName()
{
return 'selection';
}
/**
* @param SelectionEvent $event
* @throws \Propel\Runtime\Exception\PropelException
*/
public function delete(SelectionEvent $event)
{
$this->getSelection($event)->delete();
RewritingUrlQuery::create()
->filterByView($this->getRewrittenUrlViewName())
->filterByViewId($event->getId())
->update(array(
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
));
}
protected function getSelection(SelectionEvent $event)
{
$model = SelectionQuery::create()
->findPk($event->getId());
if (null === $model) {
throw new \RuntimeException(sprintf(
"Selection id '%d' doesn't exist",
$event->getId()
));
}
return $model;
}
/**
* @param SelectionEvent $event
* @param Selection $model
* @throws \Exception
*/
protected function createOrUpdate(SelectionEvent $event, Selection $model)
{
$con = Propel::getConnection(SelectionTableMap::DATABASE_NAME);
$con->beginTransaction();
try {
if (null !== $locale = $event->getLocale()) {
$model->setLocale($locale);
}
if (null !== $id = $event->getId()) {
$model->setId($id);
}
if (null !== $code = $event->getCode()) {
$model->setCode($code);
}
if (null !== $title = $event->getTitle()) {
$model->setTitle($title);
}
if (null !== $chapo = $event->getChapo()) {
$model->setChapo($chapo);
}
if (null !== $description = $event->getDescription()) {
$model->setDescription($description);
}
if (null !== $postscriptum = $event->getPostscriptum()) {
$model->setPostscriptum($postscriptum);
}
$model->save();
$event->setSelection($model);
$this->updateContainerAssociatedToSelection($event, $con);
$con->commit();
} catch (\Exception $e) {
$con->rollBack();
Tlog::getInstance()->error($e->getMessage());
throw $e;
}
}
/**
* @param SelectionEvent $event
* @param ConnectionInterface $con
* @throws \Propel\Runtime\Exception\PropelException
*/
protected function updateContainerAssociatedToSelection(SelectionEvent $event, ConnectionInterface $con)
{
$associationQuery = SelectionContainerAssociatedSelectionQuery::create();
$association = $associationQuery->findOneBySelectionId($event->getId());
$containerId = $event->getContainerId();
if ($association === null) {
if (empty($containerId)) {
return;
}
$association = new SelectionContainerAssociatedSelection();
$association->setSelectionId($event->getId());
} else if ($association->getSelectionContainerId() === $containerId) {
return;
} else if (empty($containerId)) {
$association->delete($con);
return;
}
$association->setSelectionContainerId($containerId);
$association->save($con);
}
/**
* @param SelectionEvent $event
* @throws \Propel\Runtime\Exception\PropelException
*/
public function toggleVisibility(SelectionEvent $event)
{
$selection = $event->getSelection();
$selection
->setVisible($selection->getVisible() ? false : true)
->save()
;
$event->setSelection($selection);
}/** @noinspection PhpUnusedParameterInspection */
/**
* Changes position, selecting absolute or relative change.
*
* @param UpdatePositionEvent $event
* @param $eventName
* @param EventDispatcherInterface $dispatcher
*/
public function updateProductPosition(
UpdatePositionEvent $event,
/** @noinspection PhpUnusedParameterInspection */
$eventName,
/** @noinspection PhpUnusedParameterInspection */
EventDispatcherInterface $dispatcher
) {
$this->genericUpdateDelegatePosition(
SelectionProductQuery::create()
->filterByProductId($event->getObjectId())
->filterBySelectionId($event->getReferrerId()),
$event
);
}
/**
* @param UpdatePositionEvent $event
* @param $eventName
* @param EventDispatcherInterface $dispatcher
*/
public function updatePosition(
UpdatePositionEvent $event,
/** @noinspection PhpUnusedParameterInspection */
$eventName,
EventDispatcherInterface $dispatcher
) {
$modelCriteria = SelectionQuery::create()->filterById($event->getObjectId());
$this->genericUpdateDelegatePosition(
$modelCriteria,
$event,
$dispatcher
);
}
protected function genericUpdateDelegatePosition(
ModelCriteria $query,
UpdatePositionEvent $event,
EventDispatcherInterface $dispatcher = null
) {
if (null !== $object = $query->findOne()) {
if (!isset(class_uses($object)['Thelia\Model\Tools\PositionManagementTrait'])) {
throw new \InvalidArgumentException("Your model does not implement the PositionManagementTrait trait");
}
if (!is_null($dispatcher)) {
$object->setDispatcher($dispatcher);
}
$mode = $event->getMode();
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE) {
$object->changeAbsolutePosition($event->getPosition());
} elseif ($mode == UpdatePositionEvent::POSITION_UP) {
$object->movePositionUp();
} elseif ($mode == UpdatePositionEvent::POSITION_DOWN) {
$object->movePositionDown();
}
}
}
public static function getSubscribedEvents()
{
return array(
SelectionEvents::SELECTION_CREATE => array("create", 128),
SelectionEvents::SELECTION_UPDATE => array("update", 128),
SelectionEvents::SELECTION_DELETE => array("delete", 128),
SelectionEvents::SELECTION_UPDATE_SEO => array("updateSeo", 128),
SelectionEvents::SELECTION_UPDATE_POSITION => array("updatePosition", 128),
SelectionEvents::SELECTION_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
SelectionEvents::RELATED_PRODUCT_UPDATE_POSITION => array("updateProductPosition", 128),
);
}
}

View File

@@ -0,0 +1,217 @@
<?php
/**
* Created by PhpStorm.
* User: audreymartel
* Date: 10/07/2018
* Time: 10:14
*/
namespace Selection\Action;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\Propel;
use Selection\Event\SelectionContainerEvent;
use Selection\Event\SelectionEvents;
use Selection\Model\Map\SelectionContainerTableMap;
use Selection\Model\SelectionContainer;
use Selection\Model\SelectionContainerQuery;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Action\BaseAction;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Log\Tlog;
class SelectionContainerAction extends BaseAction implements EventSubscriberInterface
{
/** @var EventDispatcherInterface */
protected $eventDispatcher;
/**
* @param SelectionContainerEvent $event
* @throws \Exception
*/
public function create(SelectionContainerEvent $event)
{
$this->createOrUpdate($event, new SelectionContainer());
}
/**
* @param SelectionContainerEvent $event
* @throws \Exception
*/
public function update(SelectionContainerEvent $event)
{
$model = $this->getSelectionContainer($event);
$this->createOrUpdate($event, $model);
}
/**
* @param UpdateSeoEvent $event
* @param $eventName
* @param EventDispatcherInterface $dispatcher
* @return mixed
*/
public function updateSeo(
UpdateSeoEvent $event,
/** @noinspection PhpUnusedParameterInspection */
$eventName,
EventDispatcherInterface $dispatcher
) {
return $this->genericUpdateSeo(SelectionContainerQuery::create(), $event, $dispatcher);
}
/**
* @param SelectionContainerEvent $event
* @throws \Propel\Runtime\Exception\PropelException
*/
public function delete(SelectionContainerEvent $event)
{
$this->getSelectionContainer($event)->delete();
}
protected function getSelectionContainer(SelectionContainerEvent $event)
{
$model = SelectionContainerQuery::create()->findPk($event->getId());
if (null === $model) {
throw new \RuntimeException(sprintf(
"SelectionContainer id '%d' doesn't exist",
$event->getId()
));
}
return $model;
}
/**
* @param SelectionContainerEvent $event
* @param SelectionContainer $model
* @throws \Exception
*/
protected function createOrUpdate(SelectionContainerEvent $event, SelectionContainer $model)
{
$con = Propel::getConnection(SelectionContainerTableMap::DATABASE_NAME);
$con->beginTransaction();
try {
if (null !== $locale = $event->getLocale()) {
$model->setLocale($locale);
}
if (null !== $id = $event->getId()) {
$model->setId($id);
}
if (null !== $code = $event->getCode()) {
$model->setCode($code);
}
if (null !== $title = $event->getTitle()) {
$model->setTitle($title);
}
if (null !== $chapo = $event->getChapo()) {
$model->setChapo($chapo);
}
if (null !== $description = $event->getDescription()) {
$model->setDescription($description);
}
if (null !== $postscriptum = $event->getPostscriptum()) {
$model->setPostscriptum($postscriptum);
}
$model->save();
$event->setSelectionContainer($model);
$con->commit();
} catch (\Exception $e) {
$con->rollBack();
Tlog::getInstance()->error($e->getMessage());
throw $e;
}
}
/**
* @param SelectionContainerEvent $event
* @throws \Propel\Runtime\Exception\PropelException
*/
public function toggleVisibility(SelectionContainerEvent $event)
{
$selectionContainer = $event->getSelectionContainer();
$selectionContainer
->setVisible($selectionContainer->getVisible() ? false : true)
->save()
;
$event->setSelectionContainer($selectionContainer);
}
/**
* @param UpdatePositionEvent $event
* @param $eventName
* @param EventDispatcherInterface $dispatcher
*/
public function updatePosition(
UpdatePositionEvent $event,
/** @noinspection PhpUnusedParameterInspection */
$eventName,
EventDispatcherInterface $dispatcher
) {
$modelCriteria = SelectionContainerQuery::create()->filterById($event->getObjectId());
$this->genericUpdateDelegatePosition(
$modelCriteria,
$event,
$dispatcher
);
}
/**
* @param ModelCriteria $query
* @param UpdatePositionEvent $event
* @param EventDispatcherInterface|null $dispatcher
*/
protected function genericUpdateDelegatePosition(
ModelCriteria $query,
UpdatePositionEvent $event,
EventDispatcherInterface $dispatcher = null
) {
if (null !== $object = $query->findOne()) {
if (!isset(class_uses($object)['Thelia\Model\Tools\PositionManagementTrait'])) {
throw new \InvalidArgumentException("Your model does not implement the PositionManagementTrait trait");
}
if (!is_null($dispatcher)) {
$object->setDispatcher($dispatcher);
}
$mode = $event->getMode();
if ($mode === UpdatePositionEvent::POSITION_ABSOLUTE) {
$object->changeAbsolutePosition($event->getPosition());
} elseif ($mode === UpdatePositionEvent::POSITION_UP) {
$object->movePositionUp();
} elseif ($mode === UpdatePositionEvent::POSITION_DOWN) {
$object->movePositionDown();
}
}
}
/**
* Returns an array of event names this subscriber wants to listen to.
* @return array The event names to listen to
*/
public static function getSubscribedEvents()
{
return array(
SelectionEvents::SELECTION_CONTAINER_CREATE => array("create", 128),
SelectionEvents::SELECTION_CONTAINER_UPDATE => array("update", 128),
SelectionEvents::SELECTION_CONTAINER_DELETE => array("delete", 128),
SelectionEvents::SELECTION_CONTAINER_UPDATE_SEO => array("updateSeo", 128),
SelectionEvents::SELECTION_CONTAINER_UPDATE_POSITION => array("updatePosition", 128),
SelectionEvents::SELECTION_CONTAINER_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
);
}
}

View File

@@ -0,0 +1,48 @@
#Selection module changelog
###1.1.9
- Fixed title and language issues when editing a selection
###1.1.8
- Invisible products are not displayed anymore when editing a selection
###1.1.7
- Fixed rewritten urls not marked as obsolete on deletion
###1.1.6
- Fix products position update
###1.1.4
- #13 added missing update folder
###1.1.3
- #12 main loop wasn't returning meta infos
###1.1.2
- Fixed a duplication bug when displaying the selections in the back office
###1.1.1
- Added a 'SELECTION_URL' variable returned by the selection_list loop
##1.1
- Cleaned a bit the code and added a few comments
- The 'title' parameter in the selection_list loop now actually works
- (#2) Added an exclude parameter to the selection_list loop
- (#3) Explained how to get the correct rewritten URL in the README
- (#4 & #7) The selection description can now be correctly called and displayed from the selection_list loop
- (#4) The selection chapo can now be correctly called and displayed from the selection_list loop
- (#4) The selection postscriptum can now be correctly called and displayed from the selection_list loop
- (#6) Added arrow buttons surrounding the products when editing a selection to change their position
- (#6) You can now change the position of a product in the list by clicking on it then choosing a new position.
- (#9) Rewrote the Readme with a better description and in a better english
##1.0
- Initial release
##Contributors
- Maxime Bruchet <mbruchet@openstudio.fr>
- Luc Normandon <lucnormandon@openstudio.fr>

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<loop name="selection_list" class="Selection\Loop\SelectionLoop"/>
<loop name="selection_container" class="Selection\Loop\SelectionContainerLoop"/>
<loop name="selection_category" class="Selection\Loop\SelectionLoopCategory"/>
<loop name="selection_folder" class="Selection\Loop\SelectionLoopFolder"/>
<loop name="selection_image" class="Selection\Loop\SelectionImage"/>
<loop name="selection_content_related" class="Selection\Loop\SelectionContentRelated"/>
<loop name="selection_product_related" class="Selection\Loop\SelectionProductRelated"/>
</loops>
<forms>
<form name="admin.selection.update" class="Selection\Form\SelectionUpdateForm"/>
<form name="admin.selection.create" class="Selection\Form\SelectionCreateForm"/>
<form name="admin.selection.seo" class="Thelia\Form\SelectionCreateForm"/>
<form name="admin.selection.image.modification" class="Selection\Form\SelectionImageModification"/>
<form name="admin.selection.container.create" class="Selection\Form\SelectionContainerCreateForm"/>
<form name="admin.selection.container.update" class="Selection\Form\SelectionContainerUpdateForm"/>
<form name="admin.selection.container.seo" class="Thelia\Form\SelectionCreateForm"/>
<form name="admin.selection.container.image.modification" class="Selection\Form\SelectioncontainerImageModification"/>
</forms>
<services>
<service id="selection.action.customer" class="Selection\Action\SelectionAction">
<tag name="kernel.event_subscriber"/>
</service>
<service id="selection.container.action" class="Selection\Action\SelectionContainerAction">
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.file_manager" class="Thelia\Files\FileManager">
<argument>%file_model.classes%</argument>
</service>
</services>
<hooks>
<hook id="selection.hook">
</hook>
<hook id="Selection.hook.back" class="Selection\Hook\BackHook">
<tag name="hook.event_listener" event="main.top-menu-tools" type="back"/>
</hook>
</hooks>
</config>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://thelia.net/schema/dic/module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
<fullnamespace>Selection\Selection</fullnamespace>
<descriptive locale="en_US">
<title>Selection of product and/or content</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Selection de produits et/ou de contenus</title>
</descriptive>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.1.14</version>
<authors>
<author>
<name>Maxime BRUCHET</name>
<email>mbruchet@openstudio.fr</email>
</author>
<author>
<name>Franck Allimant</name>
<company>OpenStudio</company>
<email>fallimant@openstudio.fr</email>
<website>www.openstudio.fr</website>
</author>
</authors>
<type>classic</type>
<thelia>2.3.4</thelia>
<stability>other</stability>
</module>

View File

@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<!-- ******************************* Root link to selection list ******************************* -->
<route id="selection.list" path="/admin/selection">
<default key="_controller">Selection\Controller\SelectionController::viewAction</default>
</route>
<!-- ******************************* Root link to update management ******************************* -->
<!-- ***** Default page of management update-->
<route id="selection.update" path="/admin/selection/update/{selectionId}" methods="get">
<default key="_controller">Selection\Controller\SelectionUpdateController::updateAction</default>
<requirement key="selectionID">\d+</requirement>
</route>
<!-- ***** Root to function which return value in select-->
<route id="selection.update.getProductRelated" path="admin/selection/update/getProductRelated/{categoryID}">
<default key="_controller">Selection\Controller\SelectionRelatedProductController::getProductRelated</default>
<requirement key="categoryID">\d+</requirement>
</route>
<!-- ***** Root to function which add value-->
<route id="selection.update.getContentRelated" path="/admin/selection/update/getContentRelated/{folderID}">
<default key="_controller">Selection\Controller\SelectionRelatedContentController::getContentRelated</default>
<requirement key="folderID">\d+</requirement>
</route>
<route id="admin.selection.update.addProductRelated" path="admin/selection/update/addProductRelated/{productID}{selectionID}">
<default key="_controller">Selection\Controller\SelectionRelatedProductController::addProductRelated</default>
<requirement key="productID">\d+</requirement>
<requirement key="selectionID">\d+</requirement>
</route>
<route id="admin.selection.update.addContentRelated" path="/admin/selection/update/addContentRelated/{contentID}{selectionID}">
<default key="_controller">Selection\Controller\SelectionRelatedContentController::addContentRelated</default>
<requirement key="contentID">\d+</requirement>
<requirement key="selectionID">\d+</requirement>
</route>
<!-- ***** Root to function which return value to show in table-->
<route id="selection.show.productInTable" path="/admin/selection/update/showProduct/{selectionID}">
<default key="_controller">Selection\Controller\SelectionRelatedProductController::showProduct</default>
<requirement key="selectionID">\d+</requirement>
</route>
<route id="selection.show.contentInTable" path="/admin/selection/update/showContent/{selectionID}">
<default key="_controller">Selection\Controller\SelectionRelatedContentController::showContent</default>
<requirement key="selectionID">\d+</requirement>
</route>
<!-- ***** Root to function which save the selection-->
<route id="selection.update.saveSelection" path="/admin/selection/save">
<default key="_controller">Selection\Controller\SelectionUpdateController::processUpdateAction</default>
</route>
<!-- ***** Root to function which create and save a new selection-->
<route id="selection.create.createSelection" path="/admin/selection/create">
<default key="_controller">Selection\Controller\SelectionUpdateController::createSelection</default>
</route>
<!-- ***** Root to function which delete a selection from the list-->
<route id="admin.delete.selection" path="/admin/selection/delete">
<default key="_controller">Selection\Controller\SelectionUpdateController::deleteAction</default>
</route>
<!-- ***** Root to function which create and save a new selection container-->
<route id="selection.create.selection.container" path="/admin/selection/container/create">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::createAction</default>
</route>
<route id="selection.update.selection.container" path="/admin/selection/container/save">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::processUpdateAction</default>
</route>
<!-- ***** Root to function which delete a selection container from the list-->
<route id="admin.delete.selection.container" path="/admin/selection/container/delete">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::deleteAction</default>
</route>
<!-- ***** Root to function which update selection container-->
<route id="admin.selection.container.view" path="/admin/selection/container/view/{selectionContainerId}">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::viewAction</default>
<requirement key="selectionContainerId">\d+</requirement>
</route>
<!-- ***** Root to function which update selection container-->
<route id="admin.selection.container.update" path="/admin/selection/container/update/{selectionContainerId}" methods="get">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::updateContainerAction</default>
<requirement key="selectionContainerId">\d+</requirement>
</route>
<route id="admin.selection.container.update-position" path="/admin/selection/container/update-position">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::updatePositionAction</default>
</route>
<!-- Visiblity of a selection container-->
<route id="admin.selection.container.set-default" path="/admin/selection/container/toggle-online">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::setToggleVisibilityAction</default>
</route>
<!-- ***** Root to function which save SEO content-->
<route id="admin.selection.seo.save" path="/admin/selection/seo/save">
<default key="_controller">Selection\Controller\SelectionUpdateController::processUpdateSeoAction</default>
</route>
<route id="admin.selection.container.seo.save" path="/admin/selection/container/seo/save">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::processUpdateSeoAction</default>
</route>
<!-- ***** Root to function which modify a related product position-->
<route id="selection.productRelated.update-position" path="/admin/selection/product-related/update-position">
<default key="_controller">Selection\Controller\SelectionUpdateController::updatePositionAction</default>
</route>
<!-- ******************************* Root link to picture edit ******************************* -->
<route id="selection.image.form-ajax" path="/selection/image/type/{parentType}/{parentId}/form-ajax">
<default key="_controller">Selection\Controller\ImageUploadController::getImageFormAjaxAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="selection.image.list-ajax" path="/selection/image/type/{parentType}/{parentId}/list-ajax">
<default key="_controller">Selection\Controller\ImageUploadController::getImageListAjaxAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="selection.image.save-ajax" path="/selection/image/type/{parentType}/{parentId}/save-ajax">
<default key="_controller">Selection\Controller\ImageUploadController::saveImageAjaxAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="selection.image.update.title" path="/selection/image/type/{parentType}/{imageId}/{parentId}/update/title" methods="post">
<default key="_controller">Selection\Controller\ImageUploadController::updateImageTitleAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="imageId">\d+</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="selection.image.update.view" path="/selection/image/type/{parentType}/{imageId}/update" methods="get">
<default key="_controller">Selection\Controller\ImageUploadController::viewImageAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="imageId">\d+</requirement>
</route>
<route id="selection.image.update.edit/admin/image/type/" path="/selection/image/type/{parentType}/{imageId}/update" methods="post">
<default key="_controller">Selection\Controller\ImageUploadController::updateImageAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="imageId">\d+</requirement>
</route>
<route id="selection.image.toggle.process" path="admin/selection/image/type/{parentType}/{documentId}/{parentId}/toggle">
<default key="_controller">Selection\Controller\ImageUploadController::toggleVisibilityImageAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="documentId">\d+</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="selection.image.delete" path="/admin/selection/image/type/{parentType}/delete/{parentId}/{imageId}">
<default key="_controller">Selection\Controller\ImageUploadController::deleteImageAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="imageId">\d+</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="admin.image.update-position" path="/admin/selection/image/type/{parentType}/{parentId}/update-position">
<default key="_controller">Selection\Controller\ImageUploadController::updateImagePositionAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<!-- Related to a selection root -->
<!-- Delete -->
<route id="admin.delete.selection.product" path="admin/selection/delete/relatedProduct/{selectionID}/{productID}">
<default key="_controller">Selection\Controller\SelectionUpdateController::deleteRelatedProduct</default>
<requirement key="selectionID">\d+</requirement>
<requirement key="productID">\d+</requirement>
</route>
<route id="admin.delete.selection.content" path="admin/selection/delete/relatedContent/{selectionID}/{contentID}">
<default key="_controller">Selection\Controller\SelectionUpdateController::deleteRelatedContent</default>
<requirement key="selectionID">\d+</requirement>
<requirement key="contentID">\d+</requirement>
</route>
<!-- Visiblity of a selection-->
<route id="admin.selection.set-default" path="/admin/selection/toggle-online">
<default key="_controller">Selection\Controller\SelectionUpdateController::setToggleVisibilityAction</default>
</route>
<route id="admin.selection.update-position" path="/admin/selection/update-position">
<default key="_controller">Selection\Controller\SelectionUpdateController::updateSelectionPositionAction</default>
</route>
</routes>

View File

@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../core/vendor/thelia/propel/resources/xsd/database.xsd" >
<table name="selection" namespace="Selection\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="visible" required="true" type="TINYINT"/>
<column name="code" type="VARCHAR" size="255" />
<column name="title" type="VARCHAR" size="255" />
<column name="description" type="LONGVARCHAR" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<column name="position" type="INTEGER" />
<!-- add seo column -->
<column name="meta_title" size="255" type="VARCHAR" />
<column name="meta_description" type="LONGVARCHAR" />
<column name="meta_keywords" type="LONGVARCHAR" />
<!-- end add seo column -->
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords" />
</behavior>
</table>
<table name="selection_product" namespace="Selection\Model">
<column name="selection_id" primaryKey="true" required="true" type="INTEGER"/>
<column name="product_id" primaryKey="true" required="true" type="INTEGER"/>
<column name="position" required="true" type="INTEGER"/>
<foreign-key foreignTable="product" name="fk_selection_product_product_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="product_id"/>
</foreign-key>
<foreign-key foreignTable="selection" name="fk_selection_product_selection_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_id"/>
</foreign-key>
<behavior name="timestampable" />
</table>
<table name="selection_content" namespace="Selection\Model">
<column name="selection_id" primaryKey="true" required="true" type="INTEGER"/>
<column name="content_id" primaryKey="true" required="true" type="INTEGER"/>
<column name="position" type="INTEGER"/>
<foreign-key foreignTable="content" name="fk_selection_content_content_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="content_id"/>
</foreign-key>
<foreign-key foreignTable="selection" name="fk_selection_content_selection_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_id"/>
</foreign-key>
<behavior name="timestampable" />
</table>
<table name="selection_image" namespace="Selection\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="selection_id" required="true" type="INTEGER"/>
<column name="file" required="true" size="255" type="VARCHAR" />
<column defaultValue="1" name="visible" required="true" type="TINYINT" />
<column name="position" type="INTEGER" />
<column name="title" size="255" type="VARCHAR" />
<column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<foreign-key foreignTable="selection" name="fk_selection_image_selection_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_id" />
</foreign-key>
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
</behavior>
</table>
<table name="selection_container" namespace="Selection\Model" allowPkInsert="true">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="visible" required="true" type="TINYINT"/>
<column name="code" type="VARCHAR" size="255" />
<column name="title" type="VARCHAR" size="255" />
<column name="description" type="LONGVARCHAR" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<column name="position" type="INTEGER" />
<!-- add seo column -->
<column name="meta_title" size="255" type="VARCHAR" />
<column name="meta_description" type="LONGVARCHAR" />
<column name="meta_keywords" type="LONGVARCHAR" />
<!-- end add seo column -->
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords" />
</behavior>
</table>
<table name="selection_container_associated_selection" namespace="Selection\Model" allowPkInsert="true">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="selection_container_id" required="true" type="INTEGER"/>
<column name="selection_id" required="true" type="INTEGER"/>
<foreign-key foreignTable="selection_container" name="selection_container_associated_selection_container_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_container_id" />
</foreign-key>
<foreign-key foreignTable="selection" name="selection_container_associated_selection_selection_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_id" />
</foreign-key>
<index name="idx_selection_container_associated_selection_container_id">
<index-column name="selection_container_id" />
</index>
<index name="idx_selection_container_associated_selection_id">
<index-column name="selection_id" />
</index>
<behavior name="timestampable" />
</table>
<table name="selection_container_image" namespace="Selection\Model" allowPkInsert="true">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="selection_container_id" required="true" type="INTEGER"/>
<column name="file" required="true" size="255" type="VARCHAR" />
<column defaultValue="1" name="visible" required="true" type="TINYINT" />
<column name="position" type="INTEGER" />
<column name="title" size="255" type="VARCHAR" />
<column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<foreign-key foreignTable="selection_container" name="fk_selection_container_image_selection_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_container_id" />
</foreign-key>
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
</behavior>
</table>
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
</database>

View File

@@ -0,0 +1,261 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- selection
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection`;
CREATE TABLE `selection`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`visible` TINYINT NOT NULL,
`code` VARCHAR(255),
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_product
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_product`;
CREATE TABLE `selection_product`
(
`selection_id` INTEGER NOT NULL,
`product_id` INTEGER NOT NULL,
`position` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`selection_id`,`product_id`),
INDEX `fi_selection_product_product_id` (`product_id`),
CONSTRAINT `fk_selection_product_product_id`
FOREIGN KEY (`product_id`)
REFERENCES `product` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_selection_product_selection_id`
FOREIGN KEY (`selection_id`)
REFERENCES `selection` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_content
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_content`;
CREATE TABLE `selection_content`
(
`selection_id` INTEGER NOT NULL,
`content_id` INTEGER NOT NULL,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`selection_id`,`content_id`),
INDEX `fi_selection_content_content_id` (`content_id`),
CONSTRAINT `fk_selection_content_content_id`
FOREIGN KEY (`content_id`)
REFERENCES `content` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_selection_content_selection_id`
FOREIGN KEY (`selection_id`)
REFERENCES `selection` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_image
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_image`;
CREATE TABLE `selection_image`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`selection_id` INTEGER NOT NULL,
`file` VARCHAR(255) NOT NULL,
`visible` TINYINT DEFAULT 1 NOT NULL,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `fi_selection_image_selection_id` (`selection_id`),
CONSTRAINT `fk_selection_image_selection_id`
FOREIGN KEY (`selection_id`)
REFERENCES `selection` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_container`;
CREATE TABLE `selection_container`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`visible` TINYINT NOT NULL,
`code` VARCHAR(255),
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_associated_selection
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_container_associated_selection`;
CREATE TABLE `selection_container_associated_selection`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`selection_container_id` INTEGER NOT NULL,
`selection_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_selection_container_associated_selection_container_id` (`selection_container_id`),
INDEX `idx_selection_container_associated_selection_id` (`selection_id`),
CONSTRAINT `selection_container_associated_selection_container_id`
FOREIGN KEY (`selection_container_id`)
REFERENCES `selection_container` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `selection_container_associated_selection_selection_id`
FOREIGN KEY (`selection_id`)
REFERENCES `selection` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_image
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_container_image`;
CREATE TABLE `selection_container_image`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`selection_container_id` INTEGER NOT NULL,
`file` VARCHAR(255) NOT NULL,
`visible` TINYINT DEFAULT 1 NOT NULL,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `fi_selection_container_image_selection_id` (`selection_container_id`),
CONSTRAINT `fk_selection_container_image_selection_id`
FOREIGN KEY (`selection_container_id`)
REFERENCES `selection_container` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_i18n`;
CREATE TABLE `selection_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
`chapo` TEXT,
`postscriptum` TEXT,
`meta_title` VARCHAR(255),
`meta_description` TEXT,
`meta_keywords` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `selection_i18n_fk_765b89`
FOREIGN KEY (`id`)
REFERENCES `selection` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_image_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_image_i18n`;
CREATE TABLE `selection_image_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `selection_image_i18n_fk_d501a8`
FOREIGN KEY (`id`)
REFERENCES `selection_image` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_container_i18n`;
CREATE TABLE `selection_container_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
`chapo` TEXT,
`postscriptum` TEXT,
`meta_title` VARCHAR(255),
`meta_description` TEXT,
`meta_keywords` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `selection_container_i18n_fk_25b287`
FOREIGN KEY (`id`)
REFERENCES `selection_container` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_image_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_container_image_i18n`;
CREATE TABLE `selection_container_image_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `selection_container_image_i18n_fk_eed190`
FOREIGN KEY (`id`)
REFERENCES `selection_container_image` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,11 @@
SET FOREIGN_KEY_CHECKS = 0;
-- Add the 'code' column to the selection tables.
ALTER TABLE `selection` ADD `code` varchar(255) NOT NULL AFTER `visible`;
ALTER TABLE `selection_container` ADD `code` varchar(255) NOT NULL AFTER `visible`;
-- Generate a pseudo-code for each existing selection
UPDATE `selection` set `code` = CONCAT('selection_', id);
UPDATE `selection_container` set `code` = CONCAT('container_', id);
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,111 @@
ALTER TABLE selection_i18n MODIFY description LONGTEXT;
ALTER TABLE selection_i18n MODIFY chapo LONGTEXT;
ALTER TABLE selection_i18n MODIFY postscriptum LONGTEXT;
-- ---------------------------------------------------------------------
-- selection_container
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `selection_container`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`visible` TINYINT NOT NULL,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE = InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_associated_selection
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `selection_container_associated_selection`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`selection_container_id` INTEGER NOT NULL,
`selection_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_selection_container_associated_selection_container_id`( `selection_container_id`
),
INDEX `idx_selection_container_associated_selection_id` (`selection_id`
),
CONSTRAINT `selection_container_associated_selection_container_id`
FOREIGN KEY (`selection_container_id`
)
REFERENCES `selection_container` (`id`
)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `selection_container_associated_selection_selection_id`
FOREIGN KEY (`selection_id`)
REFERENCES `selection` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_i18n
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `selection_container_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
`chapo` TEXT,
`postscriptum` TEXT,
`meta_title` VARCHAR(255),
`meta_description` TEXT,
`meta_keywords` TEXT,
PRIMARY KEY (`id`, `locale`),
CONSTRAINT `selection_container_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `selection_container` (`id`)
ON DELETE CASCADE
) ENGINE = InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_image
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS`selection_container_image`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`selection_container_id` INTEGER NOT NULL,
`file` VARCHAR(255) NOT NULL,
`visible` TINYINT DEFAULT 1 NOT NULL,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `FI_selection_container_image_selection_id` (`selection_container_id`),
CONSTRAINT `fk_selection_container_image_selection_id`
FOREIGN KEY (`selection_container_id`)
REFERENCES `selection_container` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_image_i18n
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `selection_container_image_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `selection_container_image_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `selection_container_image` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,523 @@
<?php
namespace Selection\Controller;
use Selection\Model\SelectionContainer;
use Selection\Model\SelectionContainerImage;
use Selection\Model\SelectionContainerImageQuery;
use Selection\Model\SelectionImage;
use Selection\Model\SelectionImageQuery;
use Selection\Selection;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Thelia\Controller\Admin\FileController;
use Thelia\Core\Event\File\FileCreateOrUpdateEvent;
use Thelia\Core\Event\File\FileDeleteEvent;
use Thelia\Core\Event\File\FileToggleVisibilityEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\UpdateFilePositionEvent;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Security\AccessManager;
use Thelia\Files\Exception\ProcessFileException;
use Thelia\Files\FileModelInterface;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Log\Tlog;
use Thelia\Tools\Rest\ResponseRest;
use Thelia\Tools\URL;
class ImageUploadController extends FileController
{
protected $currentRouter = Selection::ROUTER;
/**
* @inheritdoc
* @throws \Exception
*/
public function getImageListAjaxAction($parentId, $parentType)
{
$this->addModuleResource($parentType);
$this->registerFileModel($parentType);
$this->checkAccessForType(AccessManager::UPDATE, $parentType);
$this->checkXmlHttpRequest();
$args = array('imageType' => $parentType, 'parentId' => $parentId);
return $this->render('image-upload-list-ajax', $args);
}
/**
* @inheritdoc
* @throws \Exception
*/
public function getImageFormAjaxAction($parentId, $parentType)
{
$this->addModuleResource($parentType);
$this->registerFileModel($parentType);
$this->checkAccessForType(AccessManager::UPDATE, $parentType);
$this->checkXmlHttpRequest();
$args = array('imageType' => $parentType, 'parentId' => $parentId);
return $this->render('selectionImageUpdate', $args);
}
/**
* @param $imageId
* @param $parentType
* @return mixed|\Symfony\Component\HttpFoundation\Response
* @throws \Exception
*/
public function updateImageTitleAction($imageId, $parentType)
{
$this->addModuleResource($parentType);
$parentId = $this->getRequest()->get('parentId');
$this->registerFileModel($parentType);
if (null !== $response = $this->checkAccessForType(AccessManager::UPDATE, $parentType)) {
return $response;
}
$fileManager = $this->getFileManager();
$fileModelInstance = $fileManager->getModelInstance('image', $parentType);
/** @var FileModelInterface $file */
$file = $fileModelInstance->getQueryInstance()->findPk($imageId);
$new_title = $this->getRequest()->request->get('title');
$locale = $this->getRequest()->request->get('locale');
if (!empty($new_title)) {
$file->setLocale($locale);
$file->setTitle($new_title);
$file->save();
}
return $this->getImagetTypeUpdateRedirectionUrl($parentType, $parentId);
}
/**
* @param int $fileId
* @param string $parentType
* @param string $objectType
* @param string $eventName
* @return \Symfony\Component\HttpFoundation\Response|Response
* @throws \Exception
*/
public function deleteFileAction($fileId, $parentType, $objectType, $eventName)
{
$message = null;
$this->addModuleResource($parentType);
$parentId = $this->getRequest()->get('parentId');
$this->registerFileModel($parentType);
$this->checkAccessForType(AccessManager::UPDATE, $parentType);
$this->checkXmlHttpRequest();
$fileManager = $this->getFileManager();
$modelInstance = $fileManager->getModelInstance($objectType, $parentType);
$model = $modelInstance->getQueryInstance()->findPk($fileId);
if ($model == null) {
return $this->pageNotFound();
}
// Feed event
$fileDeleteEvent = new FileDeleteEvent($model);
// Dispatch Event to the Action
try {
$this->dispatch($eventName, $fileDeleteEvent);
$this->adminUpadteLogAppend(
$parentType,
$this->getTranslator()->trans(
'Deleting %obj% for %id% with parent id %parentId%',
array(
'%obj%' => $objectType,
'%id%' => $fileDeleteEvent->getFileToDelete()->getId(),
'%parentId%' => $fileDeleteEvent->getFileToDelete()->getParentId(),
)
),
$fileDeleteEvent->getFileToDelete()->getId()
);
} catch (\Exception $e) {
$message = $this->getTranslator()->trans(
'Fail to delete %obj% for %id% with parent id %parentId% (Exception : %e%)',
array(
'%obj%' => $objectType,
'%id%' => $fileDeleteEvent->getFileToDelete()->getId(),
'%parentId%' => $fileDeleteEvent->getFileToDelete()->getParentId(),
'%e%' => $e->getMessage()
)
);
}
if (null === $message) {
$message = $this->getTranslator()->trans(
'%obj%s deleted successfully',
['%obj%' => ucfirst($objectType)],
Selection::DOMAIN_NAME
);
}
$this->adminUpadteLogAppend($parentType, $message, $fileDeleteEvent->getFileToDelete()->getId());
return $this->getImagetTypeUpdateRedirectionUrl($parentType, $parentId);
}
/*----------------- My parts */
/**
* @param int $parentId
* @param string $parentType
* @param string $objectType
* @param array $validMimeTypes
* @param array $extBlackList
* @return mixed|\Symfony\Component\HttpFoundation\Response|Response|ResponseRest
* @throws \Exception
*/
public function saveFileAjaxAction(
$parentId,
$parentType,
$objectType,
$validMimeTypes = array(),
$extBlackList = array()
) {
$this->addModuleResource($parentType);
$this->registerFileModel($parentType);
if (null !== $response = $this->checkAccessForType(AccessManager::UPDATE, $parentType)) {
return $response;
}
$this->checkXmlHttpRequest();
if ($this->getRequest()->isMethod('POST')) {
/** @var UploadedFile $fileBeingUploaded */
$fileBeingUploaded = $this->getRequest()->files->get('file');
try {
if (null !== $fileBeingUploaded) {
$this->processFile(
$fileBeingUploaded,
$parentId,
$parentType,
$objectType,
$validMimeTypes,
$extBlackList
);
}
} catch (ProcessFileException $e) {
return new ResponseRest($e->getMessage(), 'text', $e->getCode());
}
return $this->getImagetTypeUpdateRedirectionUrl($parentType, $parentId);
}
return new Response('', 404);
}
/**
* @param int $imageId
* @param string $parentType
* @return mixed|Response
* @throws \Exception
*/
public function viewImageAction($imageId, $parentType)
{
$this->addModuleResource($parentType);
$this->registerFileModel($parentType);
if (null !== $response = $this->checkAccessForType(AccessManager::UPDATE, $parentType)) {
return $response;
}
$fileManager = $this->getFileManager();
$imageModel = $fileManager->getModelInstance('image', $parentType);
$image = null;
$parentId = null;
if (SelectionContainer::IMAGE_TYPE_LABEL === $parentType) {
$image = SelectionContainerImageQuery::create()->findPk($imageId);
if ($image !== null) {
$parentId = $image->getSelectionContainerId();
}
} else {
$image = SelectionImageQuery::create()->findPk($imageId);
if ($image !== null) {
$parentId = $image->getSelectionId();
}
}
if ($image === null) {
return $this->pageNotFound();
}
$redirectUrl = $this->getImagetTypeUpdateRedirectionUrl($parentType, $parentId);
return $this->render('selection-image-edit', array(
'imageId' => $imageId,
'imageType' => $parentType,
'redirectUrl' => $redirectUrl,
'formId' => $imageModel->getUpdateFormId(),
'breadcrumb' => $image->getBreadcrumb(
$this->getRouter($this->getCurrentRouter()),
$this->container,
'images',
$this->getCurrentEditionLocale()
)
));
}
/**
* @param int $fileId
* @param string $parentType
* @param string $objectType
* @param string $eventName
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function updateFileAction($fileId, $parentType, $objectType, $eventName)
{
$message = false;
$fileManager = $this->getFileManager();
$fileModelInstance = $fileManager->getModelInstance($objectType, $parentType);
$fileUpdateForm = $this->createForm($fileModelInstance->getUpdateFormId());
/** @var FileModelInterface $file */
$file = $fileModelInstance->getQueryInstance()->findPk($fileId);
try {
$oldFile = clone $file;
if (null === $file) {
throw new \InvalidArgumentException(sprintf('%d %s id does not exist', $fileId, $objectType));
}
$data = $this->validateForm($fileUpdateForm)->getData();
$event = new FileCreateOrUpdateEvent(null);
if (array_key_exists('visible', $data)) {
$file->setVisible($data['visible'] ? 1 : 0);
}
$file->setLocale($data['locale']);
if (array_key_exists('title', $data)) {
$file->setTitle($data['title']);
}
if (array_key_exists('chapo', $data)) {
$file->setChapo($data['chapo']);
}
if (array_key_exists('description', $data)) {
$file->setDescription($data['description']);
}
if (array_key_exists('postscriptum', $data)) {
$file->setPostscriptum($data['postscriptum']);
}
if (isset($data['file'])) {
$file->setFile($data['file']);
}
$event->setModel($file);
$event->setOldModel($oldFile);
$files = $this->getRequest()->files;
$fileForm = $files->get($fileUpdateForm->getName());
if (isset($fileForm['file'])) {
$event->setUploadedFile($fileForm['file']);
}
$this->dispatch($eventName, $event);
$fileUpdated = $event->getModel();
$this->adminUpadteLogAppend(
$parentType,
sprintf(
'%s with Ref %s (ID %d) modified',
ucfirst($objectType),
$fileUpdated->getTitle(),
$fileUpdated->getId()
),
$fileUpdated->getId()
);
} catch (FormValidationException $e) {
$message = sprintf('Please check your input: %s', $e->getMessage());
} catch (\Exception $e) {
$message = sprintf('Sorry, an error occurred: %s', $e->getMessage() . ' ' . $e->getFile());
}
if ($message !== false) {
Tlog::getInstance()->error(sprintf('Error during %s editing : %s.', $objectType, $message));
$fileUpdateForm->setErrorMessage($message);
$this->getParserContext()
->addForm($fileUpdateForm)
->setGeneralError($message);
}
if ($this->getRequest()->get('save_mode') === 'close') {
return $this->generateRedirect(
URL::getInstance()->absoluteUrl($file->getRedirectionUrl(), ['current_tab' => 'images'])
);
}
return $this->generateSuccessRedirect($fileUpdateForm);
}
/**
* @param int $imageId
* @param string $parentType
* @return mixed|Response|FileModelInterface
* @throws \Exception
*/
public function updateImageAction($imageId, $parentType)
{
$this->addModuleResource($parentType);
if (null !== $response = $this->checkAccessForType(AccessManager::UPDATE, $parentType)) {
return $response;
}
$this->registerFileModel($parentType);
return $this->updateFileAction($imageId, $parentType, 'image', TheliaEvents::IMAGE_UPDATE);
}
/**
* @param $documentId
* @param string $parentType
* @param string $objectType
* @param string $eventName
* @return \Symfony\Component\HttpFoundation\Response|Response
* @throws \Exception
*/
public function toggleVisibilityFileAction($documentId, $parentType, $objectType, $eventName)
{
$message = null;
$this->addModuleResource($parentType);
$parentId = $this->getRequest()->get('parentId');
$this->registerFileModel($parentType);
$this->checkAccessForType(AccessManager::UPDATE, $parentType);
$this->checkXmlHttpRequest();
$fileManager = $this->getFileManager();
$modelInstance = $fileManager->getModelInstance($objectType, $parentType);
$model = $modelInstance->getQueryInstance()->findPk($documentId);
if ($model === null) {
return $this->pageNotFound();
}
// Feed event
$event = new FileToggleVisibilityEvent(
$modelInstance->getQueryInstance(),
$documentId
);
// Dispatch Event to the Action
try {
$this->dispatch($eventName, $event);
} catch (\Exception $e) {
$message = $this->getTranslator()->trans(
'Fail to update %type% visibility: %err%',
['%type%' => $objectType, '%err%' => $e->getMessage()]
);
}
if (null === $message) {
$message = $this->getTranslator()->trans(
'%type% visibility updated',
['%type%' => ucfirst($objectType)]
);
}
$this->adminUpadteLogAppend($parentType, $message, $documentId);
return $this->generateRedirectFromRoute('selection.update', [], ['selectionId' => $parentId], null);
}
/**
* @param $parentType
* @param $parentId
* @param $objectType
* @param $eventName
* @return Response
* @throws \Exception
*/
public function updateFilePositionAction($parentType, $parentId, $objectType, $eventName)
{
$message = null;
$this->addModuleResource($parentType);
$this->registerFileModel($parentType);
$position = $this->getRequest()->request->get('position');
$this->checkAccessForType(AccessManager::UPDATE, $parentType);
$this->checkXmlHttpRequest();
$fileManager = $this->getFileManager();
$modelInstance = $fileManager->getModelInstance($objectType, $parentType);
$model = $modelInstance->getQueryInstance()->findPk($parentId);
if ($model === null || $position === null) {
return $this->pageNotFound();
}
// Feed event
$event = new UpdateFilePositionEvent(
$modelInstance->getQueryInstance(),
$parentId,
UpdateFilePositionEvent::POSITION_ABSOLUTE,
$position
);
// Dispatch Event to the Action
try {
$this->dispatch($eventName, $event);
} catch (\Exception $e) {
$message = $this->getTranslator()->trans(
'Fail to update %type% position: %err%',
['%type%' => $objectType, '%err%' => $e->getMessage()]
);
}
if (null === $message) {
$message = $this->getTranslator()->trans(
'%type% position updated',
['%type%' => ucfirst($objectType)]
);
}
return new Response($message);
}
/**
* @param string $type
* @param $message string
* @param string|null $resourceId
*/
protected function adminUpadteLogAppend($type, $message, $resourceId = null)
{
$this->adminLogAppend(
$this->getAdminResources()->getResource($type, ucfirst(Selection::DOMAIN_NAME)),
AccessManager::UPDATE,
$message,
$resourceId
);
}
/**
* @param string $type
* @throws \Exception
*/
protected function addModuleResource($type)
{
$data = [strtoupper($type) => "admin.selection"];
$module = ucfirst(Selection::DOMAIN_NAME);
/** @noinspection PhpParamsInspection */
$this->getAdminResources()->addModuleResources($data, $module);
}
/**
* @param string $access
* @param string $type
* @return mixed null if authorization is granted, or a Response object which contains the error page otherwise
*/
protected function checkAccessForType($access, $type)
{
return $this->checkAuth(
$this->getAdminResources()->getResource($type, ucfirst(Selection::DOMAIN_NAME)),
array(),
$access
);
}
/**
* @param string $type
*/
private function registerFileModel($type)
{
$this->getFileManager()->addFileModel(
'image',
$type,
$type === 'SelectionContainer' ? SelectionContainerImage::class : SelectionImage::class
);
}
private function getImagetTypeUpdateRedirectionUrl($parentType, $parentId)
{
if ($parentType === SelectionContainer::IMAGE_TYPE_LABEL) {
return $this->generateRedirectFromRoute('admin.selection.container.update', [], ['selectionContainerId' => $parentId, 'current_tab' => 'images'], null);
}
return $this->generateRedirectFromRoute('selection.update', [], ['selectionId' => $parentId, 'current_tab' => 'images'], null);
}
}

View File

@@ -0,0 +1,362 @@
<?php
/**
* Created by PhpStorm.
* User: audreymartel
* Date: 10/07/2018
* Time: 09:38
*/
namespace Selection\Controller;
use Propel\Runtime\ActiveQuery\Criteria;
use Selection\Event\SelectionContainerEvent;
use Selection\Event\SelectionEvents;
use Selection\Form\SelectionCreateForm;
use Selection\Model\SelectionContainer;
use Selection\Model\SelectionContainerQuery;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Thelia\Controller\Admin\AbstractSeoCrudController;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Form\BaseForm;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Tools\URL;
class SelectionContainerUpdateController extends AbstractSeoCrudController
{
public function __construct()
{
parent::__construct(
'selection_container',
'selection_container_id',
'order',
AdminResources::MODULE,
SelectionEvents::SELECTION_CONTAINER_CREATE,
SelectionEvents::SELECTION_CONTAINER_UPDATE,
SelectionEvents::SELECTION_CONTAINER_DELETE,
null,
SelectionEvents::SELECTION_CONTAINER_UPDATE_POSITION,
SelectionEvents::SELECTION_CONTAINER_UPDATE_SEO,
'Selection'
);
}
/**
* Return the creation form for this object
* @return BaseForm
*/
protected function getCreationForm()
{
return $this->createForm('admin.selection.container.create');
}
/**
* Return the update form for this object
* @param array $data
* @return BaseForm
*/
protected function getUpdateForm($data = [])
{
if (!is_array($data)) {
$data = array();
}
return $this->createForm('admin.selection.container.update', 'form', $data);
}
/**
* Hydrate the update form for this object, before passing it to the update template
* @param SelectionContainer $object
* @return BaseForm
*/
protected function hydrateObjectForm($object)
{
$this->hydrateSeoForm($object);
$data = array(
'selection_container_id'=> $object->getId(),
'id' => $object->getId(),
'locale' => $object->getLocale(),
'selection_container_code' => $object->getCode(),
'selection_container_chapo' => $object->getChapo(),
'selection_container_title' => $object->getTitle(),
'selection_container_description' => $object->getDescription(),
'selection_container_postscriptum' => $object->getPostscriptum(),
'current_id' => $object->getId(),
);
return $this->getUpdateForm($data);
}
/**
* Creates the creation event with the provided form data
* @param mixed $formData
* @return \Thelia\Core\Event\ActionEvent
*/
protected function getCreationEvent($formData)
{
$event = new SelectionContainerEvent();
$event->setTitle($formData['title']);
$event->setCode($formData['code']);
$event->setChapo($formData['chapo']);
$event->setDescription($formData['description']);
$event->setPostscriptum($formData['postscriptum']);
$event->setLocale($this->getCurrentEditionLocale());
return $event;
}
/**
* Creates the update event with the provided form data
* @param mixed $formData
* @return \Thelia\Core\Event\ActionEvent
*/
protected function getUpdateEvent($formData)
{
$selectionContainer = SelectionContainerQuery::create()->findPk($formData['selection_container_id']);
$event = new SelectionContainerEvent($selectionContainer);
$event->setId($formData['selection_container_id']);
$event->setCode($formData['selection_container_code']);
$event->setTitle($formData['selection_container_title']);
$event->setChapo($formData['selection_container_chapo']);
$event->setDescription($formData['selection_container_description']);
$event->setPostscriptum($formData['selection_container_postscriptum']);
$event->setLocale($this->getCurrentEditionLocale());
return $event;
}
/**
* Creates the delete event with the provided form data
* @return \Thelia\Core\Event\ActionEvent
*/
protected function getDeleteEvent()
{
$event = new SelectionContainerEvent();
$selectionId = $this->getRequest()->request->get('selection_container_id');
$event->setId($selectionId);
return $event;
}
/**
* Return true if the event contains the object, e.g. the action has updated the object in the event.
* @param SelectionContainerEvent $event
* @return bool
*/
protected function eventContainsObject($event)
{
return $event->hasSelection();
}
/**
* Get the created object from an event.
* @param SelectionContainerEvent $event
* @return SelectionContainer
*/
protected function getObjectFromEvent($event)
{
return $event->getSelectionContainer();
}
/**
* Load an existing object from the database
*/
protected function getExistingObject()
{
$selectionContainer = SelectionContainerQuery::create()
->findPk($this->getRequest()->get('selection_container_id', 0));
if (null !== $selectionContainer) {
$selectionContainer->setLocale($this->getCurrentEditionLocale());
}
return $selectionContainer;
}
/**
* Returns the object label form the object event (name, title, etc.)
* @param SelectionContainer|null $object
* @return string
*/
protected function getObjectLabel($object)
{
return empty($object) ? '' : $object->getTitle();
}
/**
* Returns the object ID from the object
* @param SelectionContainer|null $object
* @return int
*/
protected function getObjectId($object)
{
return $object->getId();
}
/**
* Render the main list template
* @param mixed $currentOrder , if any, null otherwise.
* @return \Thelia\Core\HttpFoundation\Response
*/
protected function renderListTemplate($currentOrder)
{
return $this->render(
'selection-list',
['order' => $currentOrder]
);
}
/**
* Render the edition template
* @return \Thelia\Core\HttpFoundation\Response
*/
protected function renderEditionTemplate()
{
$selectionContainerId = $this->getRequest()->get('selection_container_id');
$currentTab = $this->getRequest()->get('current_tab');
return $this->render(
"container-edit",
[
'selection_container_id' => $selectionContainerId,
'current_tab' => $currentTab
]
);
}
/**
* Must return a RedirectResponse instance
* @return RedirectResponse
*/
protected function redirectToEditionTemplate()
{
$id = $this->getRequest()->get('selection_container_id');
return new RedirectResponse(
URL::getInstance()->absoluteUrl(
"/admin/selection/container/update/".$id
)
);
}
/**
* Must return a RedirectResponse instance
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
protected function redirectToListTemplate()
{
return new RedirectResponse(
URL::getInstance()->absoluteUrl("/admin/selection")
);
}
/**
* Online status toggle
*/
public function setToggleVisibilityAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) {
return $response;
}
$event = new SelectionContainerEvent($this->getExistingObject());
try {
$this->dispatch(SelectionEvents::SELECTION_CONTAINER_TOGGLE_VISIBILITY, $event);
} catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
// Ajax response -> no action
return $this->nullResponse();
}
public function createSelectionContainerAction()
{
$form = new SelectionCreateForm($this->getRequest());
try {
$validForm = $this->validateForm($form);
$data = $validForm->getData();
$title = $data['title'];
$chapo = $data['chapo'];
$description = $data['description'];
$postscriptum = $data['postscriptum'];
$date = new \DateTime();
$selectionContainer = new SelectionContainer();
$lastSelection = SelectionContainerQuery::create()->orderByPosition(Criteria::DESC)->findOne();
if (null !== $lastSelection) {
$position = $lastSelection->getPosition() + 1;
} else {
$position = 1;
}
$selectionContainer
->setCreatedAt($date->format('Y-m-d H:i:s'))
->setUpdatedAt($date->format('Y-m-d H:i:s'))
->setVisible(1)
->setPosition($position)
->setLocale($this->getCurrentEditionLocale())
->setTitle($title)
->setChapo($chapo)
->setDescription($description)
->setPostscriptum($postscriptum);
$selectionContainer->save();
return $this->generateRedirect("/admin/selection");
} catch (FormValidationException $ex) {
// Form cannot be validated
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
} catch (\Exception $ex) {
// Any other error
$error_msg = $ex->getMessage();
}
if (false !== $error_msg) {
$this->setupFormErrorContext(
$this->getTranslator()->trans("%obj creation", ['%obj' => $this->objectName]),
$error_msg,
$form,
$ex
);
// At this point, the form has error, and should be redisplayed.
return $this->renderList();
}
}
/**
* Show the default template : selectionList
* display selections inide the container
* @param $selectionContainerId
* @return \Thelia\Core\HttpFoundation\Response
*/
public function viewAction($selectionContainerId)
{
$this->getRequest()->request->set("selectionContainerId", $selectionContainerId);
$selectionContainer = $this->getExistingObject();
if (!is_null($selectionContainer)) {
$changeForm = $this->hydrateObjectForm($selectionContainer);
$this->getParserContext()->addForm($changeForm);
}
return $this->render("container-view",
array(
'selected_container_id' => $selectionContainerId
));
}
/**
* @param $selectionContainerId
* @return \Thelia\Core\HttpFoundation\Response
*/
public function updateContainerAction($selectionContainerId)
{
$this->getRequest()->request->set("selection_container_id", $selectionContainerId);
return parent::updateAction();
}
public function processUpdateSeoAction()
{
$selectionContainerId = $this->getRequest()->get('current_id');
$this->getRequest()->request->set("selection_container_id", $selectionContainerId);
return parent::processUpdateSeoAction();
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace Selection\Controller;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\Event\UpdatePositionEvent;
class SelectionController extends BaseAdminController
{
/**
* Show the default template : selectionList
*
* @return \Thelia\Core\HttpFoundation\Response
*/
public function viewAction()
{
return $this->render(
"selection-list",
[
'selection_order' => $this->getAttributeSelectionOrder(),
'selection_container_order' => $this->getAttributeContainerOrder()
]
);
}
private function getAttributeSelectionOrder()
{
return $this->getListOrderFromSession(
'selection',
'selection_order',
'manual'
);
}
private function getAttributeContainerOrder()
{
return $this->getListOrderFromSession(
'selectioncontainer',
'selection_container_order',
'manual'
);
}
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
{
return new UpdatePositionEvent(
$this->getRequest()->get('selection_id', null),
$positionChangeMode,
$positionValue
);
}
}

View File

@@ -0,0 +1,172 @@
<?php
namespace Selection\Controller;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Selection\Model\Map\SelectionContentTableMap;
use Selection\Model\SelectionContent;
use Selection\Model\SelectionContentQuery;
use Selection\Selection;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Model\Content;
use Thelia\Model\ContentFolder;
use Thelia\Model\ContentFolderQuery;
use Thelia\Model\ContentQuery;
use Thelia\Model\Map\ContentTableMap;
class SelectionRelatedContentController extends BaseAdminController
{
protected $currentRouter = Selection::ROUTER;
/**
* Return content id & title
*
* @return \Thelia\Core\HttpFoundation\Response
*/
public function getContentRelated()
{
$folderId = $this->getRequest()->get('folderID');
$contentCategory = ContentFolderQuery::create();
$lang = $this->getRequest()->getSession()->get('thelia.current.lang');
$result = array();
if ($folderId !== null) {
$contentCategory->filterByFolderId($folderId)->find();
if ($contentCategory !== null) {
/** @var ContentFolder $item */
foreach ($contentCategory as $item) {
$content = ContentQuery::create()
->filterById($item->getContentId())
->findOne();
$result[] =
[
'id' => $content->getId(),
'title' => $content->getTranslation($lang->getLocale())->getTitle()
];
}
}
}
return $this->jsonResponse(json_encode($result));
}
/**
* Add content to current selection
*
* @return \Thelia\Core\HttpFoundation\Response
* @throws \Propel\Runtime\Exception\PropelException
*/
public function addContentRelated()
{
$contentId = $this->getRequest()->get('contentID');
$selectionID = $this->getRequest()->get('selectionID');
$contentRelated = new SelectionContent();
if ($contentId !== null) {
$SelectionContent = SelectionContentQuery::create()
->filterBySelectionId($selectionID)
->filterByContentId($contentId)
->findOne();
if (is_null($SelectionContent)) {
$contentRelated->setSelectionId($selectionID);
$contentRelated->setContentId($contentId);
$position = SelectionContentQuery::create()
->filterBySelectionId($selectionID)
->orderByPosition(Criteria::DESC)
->select('position')
->findOne();
if (null === $position) {
$contentRelated->setPosition(1);
} else {
$contentRelated->setPosition($position+1);
}
$contentRelated->save();
}
$lang = $this->getRequest()->getSession()->get('thelia.current.lang');
$search = ContentQuery::create();
$selectionContentRelated = new Join(
ContentTableMap::ID,
SelectionContentTableMap::CONTENT_ID,
Criteria::INNER_JOIN
);
$search->addJoinObject($selectionContentRelated, 'selectionContentRelated');
$search->addJoinCondition(
'selectionContentRelated',
SelectionContentTableMap::SELECTION_ID.'='.$selectionID
);
$search->find();
/** @var Content $row */
foreach ($search as $row) {
$selectionContentPos = SelectionContentQuery::create()
->filterBySelectionId($selectionID)
->filterByContentId($row->getId())
->findOne();
$result = [
'id' => $row->getId() ,
'title' => $row->getTranslation($lang->getLocale())->getTitle(),
'position' => $selectionContentPos->getPosition()
];
}
}
return $this->render('related/contentRelated', ['selection_id' => $selectionID]);
}
/**
* Show content related to a selection
*
* @param null $p
* @return array|\Thelia\Core\HttpFoundation\Response
* @throws \Propel\Runtime\Exception\PropelException
*/
public function showContent($p = null)
{
$selectionID = $this->getRequest()->get('selectionID');
$lang = $this->getRequest()->getSession()->get('thelia.current.lang');
$search = ContentQuery::create();
$selectionContentRelated = new Join(
ContentTableMap::ID,
SelectionContentTableMap::CONTENT_ID,
Criteria::INNER_JOIN
);
$search->addJoinObject($selectionContentRelated, 'selectionContentRelated');
$search->addJoinCondition(
'selectionContentRelated',
SelectionContentTableMap::SELECTION_ID.'='.$selectionID
);
$search->find();
/** @var Content $row */
foreach ($search as $row) {
$selectionContentPos = SelectionContentQuery::create()
->filterBySelectionId($selectionID)
->filterByContentId($row->getId())
->findOne();
$result = [
'id' => $row->getId() ,
'title' => $row->getTranslation($lang->getLocale())->getTitle(),
'position' => $selectionContentPos->getPosition()
];
}
if ($p === null) {
return $this->render('related/contentRelated', ['selection_id' => $selectionID]);
} else {
return $result;
}
}
}

View File

@@ -0,0 +1,179 @@
<?php
namespace Selection\Controller;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Selection\Model\Map\SelectionProductTableMap;
use Selection\Model\SelectionProduct;
use Selection\Model\SelectionProductQuery;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\Event\Loop\LoopExtendsBuildModelCriteriaEvent;
use Thelia\Model\Map\ProductTableMap;
use Thelia\Model\Product;
use Thelia\Model\ProductCategory;
use Thelia\Model\ProductCategoryQuery;
use Thelia\Model\ProductQuery;
class SelectionRelatedProductController extends BaseAdminController
{
/**
* Return product which they are related to a category id in a select.
*
* @return \Thelia\Core\HttpFoundation\Response
*/
public function getProductRelated()
{
$categoryID = $this->getRequest()->get('categoryID');
$lang = $this->getRequest()->getSession()->get('thelia.current.lang');
$productCategory = ProductCategoryQuery::create();
$result = array();
if ($categoryID !== null) {
$productCategory->filterByCategoryId($categoryID)
->find();
if ($productCategory !== null) {
/** @var ProductCategory $item */
foreach ($productCategory as $item) {
$product = ProductQuery::create()
->filterById($item->getProductId())
->filterByVisible(1)
->findOne();
if (null !== $product) {
$result[] = [
'id' => $product->getId(),
'title' => $product->getTranslation($lang->getLocale())->getTitle()
];
}
}
}
}
return $this->jsonResponse(json_encode($result));
}
/**
* Add product to the current selection
*
* @return \Thelia\Core\HttpFoundation\Response
* @throws \Propel\Runtime\Exception\PropelException
*/
public function addProductRelated()
{
$productID = $this->getRequest()->get('productID');
$selectionID = $this->getRequest()->get('selectionID');
$lang = $this->getRequest()->getSession()->get('thelia.current.lang');
$productRelated = new SelectionProduct();
if ($productID !== null) {
$SelectionProduit = SelectionProductQuery::create()
->filterByProductId($productID)
->filterBySelectionId($selectionID)
->findOne();
if (is_null($SelectionProduit)) {
//Insert in the table Selection_product
$productRelated->setSelectionId($selectionID);
$productRelated->setProductId($productID);
$position = SelectionProductQuery::create()
->filterBySelectionId($selectionID)
->orderByPosition(Criteria::DESC)
->select('position')
->findOne();
if (null === $position) {
$productRelated->setPosition(1);
} else {
$productRelated->setPosition($position + 1);
}
$productRelated->save();
}
/** @var \Thelia\Model\Product $search */
/** @var LoopExtendsBuildModelCriteriaEvent $event */
$search = ProductQuery::create();
$selectionProductRelated = new Join(
ProductTableMap::ID,
SelectionProductTableMap::PRODUCT_ID,
Criteria::INNER_JOIN
);
$search->addJoinObject($selectionProductRelated, 'selectionProductRelated');
$search->addJoinCondition(
'selectionProductRelated',
SelectionProductTableMap::SELECTION_ID.' = '.$selectionID
);
$search->find();
$result = array();
/** @var Product $row */
foreach ($search as $row) {
$selectionProductPos = SelectionProductQuery::create()
->filterBySelectionId($selectionID)
->filterByProductId($row->getId())
->findOne();
$result = [
'id' => $row->getId() ,
'title' => $row->getTranslation($lang->getLocale())->getTitle(),
'position' => $selectionProductPos->getPosition(),
];
}
}
return $this->render('related/productRelated', ['selection_id' => $selectionID]);
}
/**
* Show product related to a selection
*
* @param null $p
* @return array|\Thelia\Core\HttpFoundation\Response
* @throws \Propel\Runtime\Exception\PropelException
*/
public function showProduct($p = null)
{
$selectionID = $this->getRequest()->get('selectionID');
$lang = $this->getRequest()->getSession()->get('thelia.current.lang');
/** @var \Thelia\Model\Product $search */
/** @var LoopExtendsBuildModelCriteriaEvent $event */
$search = ProductQuery::create();
$selectionProductRelated = new Join(
ProductTableMap::ID,
SelectionProductTableMap::PRODUCT_ID,
Criteria::INNER_JOIN
);
$search->addJoinObject($selectionProductRelated, 'selectionProductRelated');
$search->addJoinCondition(
'selectionProductRelated',
SelectionProductTableMap::SELECTION_ID.' = '.$selectionID
);
$search->find();
$result = array();
/** @var Product $row */
foreach ($search as $row) {
$selectionProductPos = SelectionProductQuery::create()
->filterBySelectionId($selectionID)
->filterByProductId($row->getId())
->findOne();
$result = [
'id' => $row->getId() ,
'title' => $row->getTranslation($lang->getLocale())->getTitle(),
'position' => $selectionProductPos->getPosition(),
];
}
if ($p === null) {
return $this->render('related/productRelated', ['selection_id' => $selectionID]);
} else {
return $result;
}
}
}

View File

@@ -0,0 +1,466 @@
<?php
namespace Selection\Controller;
use Propel\Runtime\ActiveQuery\Criteria;
use Selection\Event\SelectionContainerEvent;
use Selection\Event\SelectionEvent;
use Selection\Event\SelectionEvents;
use Selection\Form\SelectionCreateForm;
use Selection\Form\SelectionUpdateForm;
use Selection\Model\Selection as SelectionModel;
use Selection\Model\SelectionContainer;
use Selection\Model\SelectionContainerAssociatedSelection;
use Selection\Model\SelectionContentQuery;
use Selection\Model\SelectionI18nQuery;
use Selection\Model\SelectionProductQuery;
use Selection\Model\SelectionQuery;
use Selection\Selection;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Thelia\Controller\Admin\AbstractSeoCrudController;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Log\Tlog;
use Thelia\Tools\URL;
class SelectionUpdateController extends AbstractSeoCrudController
{
protected $currentRouter = Selection::ROUTER;
protected $deleteGroupEventIdentifier = SelectionEvents::SELECTION_CONTAINER_DELETE;
/**
* Save content of the selection
*
* @return \Symfony\Component\HttpFoundation\Response|\Thelia\Core\HttpFoundation\Response
* @throws \Propel\Runtime\Exception\PropelException
*/
public function saveSelection()
{
$form = new SelectionUpdateForm($this->getRequest());
$validForm = $this->validateForm($form);
$data = $validForm->getData();
$selectionID = $data['selection_id'];
$selectionCode = $data['selection_code'];
$selectionTitle = $data['selection_title'];
$selectionChapo = $data['selection_chapo'];
$selectionDescription = $data['selection_description'];
$selectionPostscriptum = $data['selection_postscriptum'];
$aSelection = SelectionQuery::create()->findPk($selectionID);
$aSelection
->setCode($selectionCode)
->setLocale($this->getCurrentEditionLocale())
->setTitle($selectionTitle)
->setChapo($selectionChapo)
->setDescription($selectionDescription)
->setPostscriptum($selectionPostscriptum)
->save();
if ($validForm->get('save_and_close')->isClicked()) {
return $this->render("electionlist");
}
return $this->generateRedirectFromRoute('selection.update', [], ['selectionId' => $selectionID], null);
}
public function createSelection()
{
$form = new SelectionCreateForm($this->getRequest());
try {
$validForm = $this->validateForm($form);
$data = $validForm->getData();
$code = $data['code'];
$title = $data['title'];
$chapo = $data['chapo'];
$description = $data['description'];
$postscriptum = $data['postscriptum'];
$containerId = (int) $data['container_id'];
$date = new \DateTime();
$selection = new SelectionModel();
$lastSelectionQuery = SelectionQuery::create()->orderByPosition(Criteria::DESC);
if ($containerId > 0) {
$lastSelectionQuery
->useSelectionContainerAssociatedSelectionQuery('toto', Criteria::LEFT_JOIN)
->filterBySelectionContainerId($containerId)
->endUse();
}
$position = 1;
if (null !== $lastSelection = $lastSelectionQuery->findOne()) {
$position = $lastSelection->getPosition() + 1;
}
$selection
->setCreatedAt($date->format('Y-m-d H:i:s'))
->setUpdatedAt($date->format('Y-m-d H:i:s'))
->setVisible(1)
->setCode($code)
->setPosition($position)
->setLocale($this->getCurrentEditionLocale())
->setTitle($title)
->setChapo($chapo)
->setDescription($description)
->setPostscriptum($postscriptum)
->save()
;
if ($containerId > 0) {
// Required, see Selection::preInsert();
$selection->setPosition($position)->save();
(new SelectionContainerAssociatedSelection())
->setSelectionContainerId($containerId)
->setSelectionId($selection->getId())
->save();
return $this->generateRedirect(URL::getInstance()->absoluteUrl("/admin/selection/container/view/" . $containerId));
}
return $this->generateRedirect(URL::getInstance()->absoluteUrl("/admin/selection"));
} catch (FormValidationException $ex) {
// Form cannot be validated
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
} catch (\Exception $ex) {
// Any other error
$error_msg = $ex->getMessage();
}
if (false !== $error_msg) {
$this->setupFormErrorContext(
$this->getTranslator()->trans("%obj creation", ['%obj' => $this->objectName]),
$error_msg,
$form,
$ex
);
// At this point, the form has error, and should be redisplayed.
return $this->renderList();
}
}
public function updateSelectionPositionAction()
{
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array(Selection::DOMAIN_NAME), AccessManager::UPDATE)) {
return $response;
}
try {
$mode = $this->getRequest()->get('mode', null);
if ($mode === 'up') {
$mode = UpdatePositionEvent::POSITION_UP;
} elseif ($mode === 'down') {
$mode = UpdatePositionEvent::POSITION_DOWN;
} else {
$mode = UpdatePositionEvent::POSITION_ABSOLUTE;
}
$position = $this->getRequest()->get('position', null);
$event = $this->createUpdateSelectionPositionEvent($mode, $position);
$this->dispatch(SelectionEvents::SELECTION_UPDATE_POSITION, $event);
} catch (\Exception $ex) {
Tlog::getInstance()->error($ex->getMessage());
}
return $this->forward('Selection\Controller\SelectionController::viewAction');
}
public function deleteRelatedProduct()
{
$selectionID = $this->getRequest()->get('selectionID');
$productID = $this->getRequest()->get('productID');
try {
$selection = SelectionProductQuery::create()
->filterByProductId($productID)
->findOneBySelectionId($selectionID);
if (null !== $selection) {
$selection->delete();
}
} catch (\Exception $e) {
Tlog::getInstance()->error($e->getMessage());
}
return $this->generateRedirectFromRoute('selection.update', [], ['selectionId' => $selectionID], null);
}
public function deleteRelatedContent()
{
$selectionID = $this->getRequest()->get('selectionID');
$contentID = $this->getRequest()->get('contentID');
try {
$selection = SelectionContentQuery::create()
->filterByContentId($contentID)
->findOneBySelectionId($selectionID);
if (null !== $selection) {
$selection->delete();
}
} catch (\Exception $e) {
Tlog::getInstance()->error($e->getMessage());
}
return $this->generateRedirectFromRoute('selection.update', [], ['selectionId' => $selectionID], null);
}
/*-------------------------- Part Controller SEO */
public function __construct()
{
parent::__construct(
'selection',
'selection_id',
'order',
AdminResources::MODULE,
SelectionEvents::SELECTION_CREATE,
SelectionEvents::SELECTION_UPDATE,
SelectionEvents::SELECTION_DELETE,
null,
SelectionEvents::RELATED_PRODUCT_UPDATE_POSITION,
SelectionEvents::SELECTION_UPDATE_SEO,
Selection::DOMAIN_NAME
);
}
protected function getCreationForm()
{
return $this->createForm('admin.selection.update');
}
protected function getUpdateForm($data = array())
{
if (!is_array($data)) {
$data = array();
}
return $this->createForm('admin.selection.update', 'form', $data);
}
/**
* $object Selection
* @param \Selection\Model\Selection $selection
* @return \Thelia\Form\BaseForm
* @throws \Propel\Runtime\Exception\PropelException
*/
protected function hydrateObjectForm($selection)
{
$this->hydrateSeoForm($selection);
$associatedContainer = $selection->getSelectionContainerAssociatedSelections();
$container = null;
if (!empty($associatedContainer) && count($associatedContainer) > 0) {
/** @var SelectionContainerAssociatedSelection[] $associatedContainer */
$container = $associatedContainer[0]->getSelectionContainerId();
}
$data = array(
'selection_id' => $selection->getId(),
'selection_container' => $container,
'id' => $selection->getId(),
'locale' => $selection->getLocale(),
'selection_code' => $selection->getCode(),
'selection_title' => $selection->getTitle(),
'selection_chapo' => $selection->getChapo(),
'selection_description' => $selection->getDescription(),
'selection_postscriptum'=> $selection->getPostscriptum(),
'current_id' => $selection->getId(),
);
return $this->getUpdateForm($data);
}
protected function getCreationEvent($formData)
{
$event = new SelectionEvent();
$event->setCode($formData['code']);
$event->setTitle($formData['title']);
$event->setChapo($formData['chapo']);
$event->setDescription($formData['description']);
$event->setPostscriptum($formData['postscriptum']);
$event->setContainerId($formData['container_id']);
return $event;
}
protected function getUpdateEvent($formData)
{
$selection = SelectionQuery::create()->findPk($formData['selection_id']);
$event = new SelectionEvent($selection);
$event->setId($formData['selection_id']);
$event->setContainerId($formData['selection_container_id']);
$event->setCode($formData['selection_code']);
$event->setTitle($formData['selection_title']);
$event->setChapo($formData['selection_chapo']);
$event->setDescription($formData['selection_description']);
$event->setPostscriptum($formData['selection_postscriptum']);
$event->setLocale($this->getCurrentEditionLocale());
return $event;
}
protected function getDeleteEvent()
{
$event = new SelectionEvent();
$selectionId = $this->getRequest()->request->get('selection_id');
$event->setId($selectionId);
return $event;
}
protected function getDeleteGroupEvent()
{
$event = new SelectionContainerEvent();
$selectionGroupId = $this->getRequest()->request->get('selection_group_id');
$event->setId($selectionGroupId);
return $event;
}
protected function eventContainsObject($event)
{
return $event->hasSelection();
}
protected function getObjectFromEvent($event)
{
return $event->getSelection();
}
protected function getExistingObject()
{
$selection = SelectionQuery::create()
->findPk($this->getRequest()->get('selectionId', 0));
if (null !== $selection) {
$selection->setLocale($this->getCurrentEditionLocale());
}
return $selection;
}
protected function getObjectLabel($object)
{
return '';
}
/**
* Returns the object ID from the object
* @param \Selection\Model\Selection $object
* @return int selection id
*/
protected function getObjectId($object)
{
return $object->getId();
}
protected function renderListTemplate($currentOrder)
{
$this->getParser()->assign("order", $currentOrder);
return $this->render('selection-list');
}
protected function renderEditionTemplate()
{
$selectionId = $this->getRequest()->get('selectionId');
$currentTab = $this->getRequest()->get('current_tab');
return $this->render(
'selection-edit',
[
'selection_id' => $selectionId,
'current_tab' => $currentTab
]
);
}
protected function redirectToEditionTemplate()
{
if (!$id = $this->getRequest()->get('selection_id')) {
$id = $this->getRequest()->get('admin_selection_update')['selection_id'];
}
return new RedirectResponse(
URL::getInstance()->absoluteUrl(
"/admin/selection/update/".$id
)
);
}
protected function redirectToListTemplate()
{
return new RedirectResponse(
URL::getInstance()->absoluteUrl("/admin/selection")
);
}
/**
* Online status toggle product
*/
public function setToggleVisibilityAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) {
return $response;
}
$event = new SelectionEvent($this->getExistingObject());
try {
$this->dispatch(SelectionEvents::SELECTION_TOGGLE_VISIBILITY, $event);
} catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
// Ajax response -> no action
return $this->nullResponse();
}
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
{
return new UpdatePositionEvent(
$this->getRequest()->get('product_id', null),
$positionChangeMode,
$positionValue,
$this->getRequest()->get('selection_id', null)
);
}
protected function createUpdateSelectionPositionEvent($positionChangeMode, $positionValue)
{
return new UpdatePositionEvent(
$this->getRequest()->get('selection_id', null),
$positionChangeMode,
$positionValue,
Selection::getModuleId()
);
}
protected function performAdditionalUpdatePositionAction($positionEvent)
{
$selectionID = $this->getRequest()->get('selection_id');
return $this->generateRedirectFromRoute('selection.update', [], ['selectionId' => $selectionID], null);
}
protected function performAdditionalDeleteAction($deleteEvent)
{
$containerId = (int) $this->getRequest()->get('container_id');
if ($containerId > 0) {
return $this->generateRedirect(URL::getInstance()->absoluteUrl("/admin/selection/container/view/" . $containerId));
}
return null;
}
public function processUpdateSeoAction()
{
$selectionId = $this->getRequest()->get('current_id');
$this->getRequest()->request->set("selectionId", $selectionId);
return parent::processUpdateSeoAction();
}
}

View File

@@ -0,0 +1,157 @@
<?php
/**
* Created by PhpStorm.
* User: audreymartel
* Date: 10/07/2018
* Time: 09:32
*/
namespace Selection\Event;
use Selection\Model\SelectionContainer;
use Thelia\Core\Event\ActionEvent;
class SelectionContainerEvent extends ActionEvent
{
protected $id;
protected $code;
protected $title;
protected $chapo;
protected $postscriptum;
protected $description;
private $selectionContainer;
private $locale;
/*----------------------------- Selection object Parts*/
public function __construct(SelectionContainer $selectionContainer = null)
{
$this->selectionContainer = $selectionContainer;
}
/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @param mixed $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @param mixed $chapo
*/
public function setChapo($chapo)
{
$this->chapo = $chapo;
}
/**
* @param mixed $postscriptum
*/
public function setPostscriptum($postscriptum)
{
$this->postscriptum = $postscriptum;
}
/**
* @param mixed $desciption
*/
public function setDescription($description)
{
$this->description = $description;
}
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
public function hasSelection()
{
return ! is_null($this->selectionContainer);
}
public function getSelectionContainer()
{
return $this->selectionContainer;
}
public function setSelectionContainer($selectionContainer)
{
$this->selectionContainer = $selectionContainer;
}
/**
* @return mixed
*/
public function getLocale()
{
return $this->locale;
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}
/**
* @return mixed
*/
public function getChapo()
{
return $this->chapo;
}
/**
* @return mixed
*/
public function getPostscriptum()
{
return $this->postscriptum;
}
/**
* @return mixed
*/
public function getDescription()
{
return $this->description;
}
/**
* @return mixed
*/
public function getCode()
{
return $this->code;
}
/**
* @param mixed $code
* @return $this
*/
public function setCode($code)
{
$this->code = $code;
return $this;
}
}

View File

@@ -0,0 +1,213 @@
<?php
namespace Selection\Event;
use Selection\Model\Selection;
use Thelia\Core\Event\ActionEvent;
class SelectionEvent extends ActionEvent
{
/*---- GENERAL parts */
protected $id;
protected $containerId;
protected $code;
protected $title;
protected $chapo;
protected $description;
protected $postscriptum;
/*---- SEO parts */
protected $url;
protected $meta_title;
protected $meta_description;
protected $meta_keywords;
/*---- LOCAL parts */
protected $locale;
protected $currentLocale;
/*---- SELECTIONS OBJECT parts */
/** @var Selection $selection */
protected $selection;
/*----------------------------- General parts */
public function getId()
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
return $this;
}
public function getTitle()
{
return $this->title;
}
public function setTitle($title)
{
$this->title = $title;
return $this;
}
public function getChapo()
{
return $this->chapo;
}
public function setChapo($chapo)
{
$this->chapo = $chapo;
return $this;
}
public function getDescription()
{
return $this->description;
}
public function setDescription($description)
{
$this->description = $description;
return $this;
}
public function getPostscriptum()
{
return $this->postscriptum;
}
public function setPostscriptum($postscriptum)
{
$this->postscriptum = $postscriptum;
return $this;
}
public function getLocale()
{
return $this->locale;
}
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/*----------------------------- SEO EVENT PARTS */
public function getUrl()
{
return $this->url;
}
public function setUrl($url)
{
$this->url = $url;
return $this;
}
public function getMetaTitle()
{
return $this->meta_title;
}
public function setMetaTitle($meta_title)
{
$this->meta_title = $meta_title;
return $this;
}
public function getMetaDescription()
{
return $this->meta_description;
}
public function setMetaDescription($meta_description)
{
$this->meta_description = $meta_description;
return $this;
}
public function getMetaKeywords()
{
return $this->meta_keywords;
}
public function setMetaKeywords($meta_keywords)
{
$this->meta_keywords = $meta_keywords;
return $this;
}
/*----------------------------- Selection object Parts*/
public function __construct(Selection $selection = null)
{
$this->selection = $selection;
}
public function getSelection()
{
return $this->selection;
}
public function setSelection($selection)
{
$this->selection = $selection;
return $this;
}
public function hasSelection()
{
return ! is_null($this->selection);
}
/**
* @return mixed
*/
public function getContainerId()
{
return $this->containerId;
}
/**
* @param mixed $containerId
*/
public function setContainerId($containerId)
{
$this->containerId = $containerId;
}
/**
* @return mixed
*/
public function getCode()
{
return $this->code;
}
/**
* @param mixed $code
* @return $this
*/
public function setCode($code)
{
$this->code = $code;
return $this;
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
* Created by PhpStorm.
* User: mbruchet
* Date: 21/03/2018
* Time: 09:20
*/
namespace Selection\Event;
class SelectionEvents
{
const BEFORE_CREATE_SELECTION = 'action.selection.before.create';
const AFTER_CREATE_SELECTION = 'action.selection.after.create';
const SELECTION_CREATE = 'action.selection.create';
const BEFORE_UPDATE_SELECTION = 'action.selection.before.update';
const AFTER_UPDATE_SELECTION = 'action.selection.after.update';
const SELECTION_UPDATE = 'action.selection.update';
const BEFORE_DELETE_SELECTION = 'action.selection.before.delete';
const AFTER_DELETE_SELECTION = 'action.selection.after.delete';
const SELECTION_DELETE = 'action.selection.delete';
const SELECTION_UPDATE_SEO = 'action.selection.update.seo';
const SELECTION_TOGGLE_VISIBILITY = 'action.toggle.selection.visibility';
const SELECTION_UPDATE_POSITION = 'action.selection.update.position';
const RELATED_PRODUCT_UPDATE_POSITION = 'action.selection.relatedProduct.update.position';
//CONTAINER EVENTS
const SELECTION_CONTAINER_CREATE = 'action.selection.container.create';
const SELECTION_CONTAINER_DELETE = 'action.selection.container.delete';
const SELECTION_CONTAINER_UPDATE = 'action.selection.container.update';
const SELECTION_CONTAINER_UPDATE_POSITION = 'action.selection.container.update.position';
const SELECTION_CONTAINER_UPDATE_SEO = 'action.selection.container.update.seo';
const SELECTION_CONTAINER_TOGGLE_VISIBILITY = 'action.selection.container.visibility';
const BEFORE_CREATE_SELECTION_CONTAINER = 'action.selection.container.before.create';
const AFTER_CREATE_SELECTION_CONTAINER = 'action.selection.container.after.create';
const BEFORE_UPDATE_SELECTION_CONTAINER = 'action.selection.container.before.update';
const AFTER_UPDATE_SELECTION_CONTAINER = 'action.selection.container.after.update';
const BEFORE_DELETE_SELECTION_CONTAINER = 'action.selection.container.before.delete';
const AFTER_DELETE_SELECTION_CONTAINER = 'action.selection.container.after.delete';
}

View File

@@ -0,0 +1,85 @@
<?php
/**
* Created by PhpStorm.
* User: audreymartel
* Date: 11/07/2018
* Time: 16:53
*/
namespace Selection\Form;
use Selection\Selection;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Validator\Constraints;
use Thelia\Core\Translation\Translator;
trait CreationCommonFieldsTrait
{
protected function addCommonFields()
{
/** @noinspection PhpUndefinedMethodInspection */
$this->formBuilder
->add(
'locale',
'hidden',
[
'constraints' => [ new Constraints\NotBlank() ],
'required' => true,
]
)
->add(
'title',
TextType::class,
array(
"constraints" => [
new Constraints\NotBlank()
],
"label" => Translator::getInstance()->trans('Title', [], Selection::DOMAIN_NAME)
)
)
->add(
'code',
TextType::class,
array(
"constraints" => [
new Constraints\NotBlank(),
new Constraints\Callback([
"methods" => [
[$this, "checkDuplicateCode"],
]
]),
],
"label" => Translator::getInstance()->trans('Code', [], Selection::DOMAIN_NAME)
)
)
->add(
'chapo',
TextareaType::class,
[
'required' => false,
"constraints" => [],
"label" => Translator::getInstance()->trans('Summary', [], Selection::DOMAIN_NAME),
]
)
->add(
'description',
TextareaType::class,
[
'required' => false,
'attr' => ['class' => 'tinymce'],
"constraints" => [],
"label" => Translator::getInstance()->trans('Description', [], Selection::DOMAIN_NAME),
]
)
->add(
'postscriptum',
TextareaType::class,
[
'required' => false,
"constraints" => [],
"label" => Translator::getInstance()->trans('Conclusion', [], Selection::DOMAIN_NAME),
]
);
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* Created by PhpStorm.
* User: audreymartel
* Date: 11/07/2018
* Time: 16:57
*/
namespace Selection\Form;
use Selection\Model\SelectionContainerQuery;
use Selection\Model\SelectionQuery;
use Selection\Selection;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
class SelectionContainerCreateForm extends BaseForm
{
use CreationCommonFieldsTrait;
protected function buildForm()
{
$this->addCommonFields();
}
public function checkDuplicateCode($value, ExecutionContextInterface $context)
{
if (SelectionContainerQuery::create()->filterByCode($value)->count() > 0) {
$context->addViolation(
Translator::getInstance()->trans(
"A selection container with code %code already exists. Please enter a different code.",
['%code' => $value],
Selection::DOMAIN_NAME
)
);
}
}
/**
* @return string the name of the form. This name need to be unique.
*/
public function getName()
{
return "admin_selection_contianer_create";
}
}

View File

@@ -0,0 +1,129 @@
<?php
/**
* Created by PhpStorm.
* User: audreymartel
* Date: 10/07/2018
* Time: 12:19
*/
namespace Selection\Form;
use Propel\Runtime\ActiveQuery\Criteria;
use Selection\Model\SelectionContainerQuery;
use Selection\Selection;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
class SelectionContainerUpdateForm extends BaseForm
{
/**
* Form build for add and update a selection
*/
protected function buildForm()
{
$this->formBuilder
->add(
'selection_container_id',
TextType::class,
array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans('Selection reference', [], Selection::DOMAIN_NAME),
"required" => false,
"read_only" => true,
)
)
->add(
'selection_container_code',
TextType::class,
array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Callback([
"methods" => [
[$this, "checkDuplicateCode"],
]
]),
),
"label" => Translator::getInstance()->trans('Selection code', [], Selection::DOMAIN_NAME),
)
)
->add(
'selection_container_title',
TextType::class,
array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans('Title', [], Selection::DOMAIN_NAME),
"required" => false,
)
)
->add(
'selection_container_chapo',
TextareaType::class,
array(
'attr' => array('class' => 'tinymce'),
"constraints" => array(
),
"label" =>Translator::getInstance()->trans('Summary', [], Selection::DOMAIN_NAME),
"required" => false,
)
)
->add(
'selection_container_description',
TextareaType::class,
array(
'attr' => array('class' => 'tinymce'),
"constraints" => array(
),
"label" =>Translator::getInstance()->trans('Description', [], Selection::DOMAIN_NAME),
"required" => false,
)
)
->add(
'selection_container_postscriptum',
TextareaType::class,
array(
'attr' => array('class' => 'tinymce'),
"constraints" => array(
),
"label" => Translator::getInstance()->trans('Conclusion', [], Selection::DOMAIN_NAME),
"required" => false,
)
)
;
}
public function checkDuplicateCode($value, ExecutionContextInterface $context)
{
$data = $context->getRoot()->getData();
$count = SelectionContainerQuery::create()
->filterById($data['selection_container_id'], Criteria::NOT_EQUAL)
->filterByCode($value)->count();
if ($count > 0) {
$context->addViolation(
Translator::getInstance()->trans(
"A selection container with code %code already exists. Please enter a different code.",
['%code' => $value],
Selection::DOMAIN_NAME
)
);
}
}
/**
* @return string the name of the form. This name need to be unique.
*/
public function getName()
{
return "admin_selection_container_update";
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace Selection\Form;
use Selection\Model\SelectionQuery;
use Selection\Selection;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
class SelectionCreateForm extends BaseForm
{
use CreationCommonFieldsTrait;
protected function buildForm()
{
$this->addCommonFields();
$this->formBuilder->add(
'container_id',
HiddenType::class,
array(
"required" => false
)
);
}
public function checkDuplicateCode($value, ExecutionContextInterface $context)
{
if (SelectionQuery::create()->filterByCode($value)->count() > 0) {
$context->addViolation(
Translator::getInstance()->trans(
"A selection with code %code already exists. Please enter a different code.",
['%code' => $value],
Selection::DOMAIN_NAME
)
);
}
}
/**
* @return string the name of the form. This name need to be unique.
*/
public function getName()
{
return "admin_selection_create";
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Selection\Form;
use Thelia\Form\Image\ImageModification;
class SelectionImageModification extends ImageModification
{
public function getName()
{
return 'selection_image_modification';
}
}

View File

@@ -0,0 +1,193 @@
<?php
namespace Selection\Form;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Exception\PropelException;
use Selection\Model\SelectionContainerQuery;
use Selection\Model\SelectionQuery;
use Selection\Selection;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
use Thelia\Log\Tlog;
use Thelia\Model\Lang;
class SelectionUpdateForm extends BaseForm
{
/**
* @var []
*/
private $containersArray;
/**
* Form build for add and update a selection
*/
protected function buildForm()
{
$this->initContainers();
$this->formBuilder
->add(
'selection_id',
TextType::class,
array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans('Selection reference', [], Selection::DOMAIN_NAME),
"required" => false,
"read_only" => true,
)
)
->add(
'selection_code',
TextType::class,
array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Callback([
"methods" => [
[$this, "checkDuplicateCode"],
]
]),
),
"label" => Translator::getInstance()->trans('Selection code', [], Selection::DOMAIN_NAME),
)
)
->add(
'selection_container',
ChoiceType::class,
[
'choices' => $this->containersArray,
'multiple' => false,
'expanded' => false,
'choice_label' => function ($key, $index, $value) {
return $key;
},
'choice_value' => function ($key) {
if (array_key_exists($key, $this->containersArray)) {
return $this->containersArray[$key];
}
return '0';
},
"label" => Translator::getInstance()->trans('Container', [], Selection::DOMAIN_NAME),
'required' => false,
'empty_data' => null,
]
)
->add(
'selection_title',
TextType::class,
[
"constraints" => [],
"label" => Translator::getInstance()->trans('Title', [], Selection::DOMAIN_NAME),
"required" => false,
]
)
->add(
'selection_chapo',
TextareaType::class,
array(
'attr' => array('class' => 'tinymce'),
"constraints" => [],
"label" =>Translator::getInstance()->trans('Summary', [], Selection::DOMAIN_NAME),
"required" => false,
)
)
->add(
'selection_description',
TextareaType::class,
array(
'attr' => array('class' => 'tinymce'),
"constraints" => [],
"label" =>Translator::getInstance()->trans('Description', [], Selection::DOMAIN_NAME),
"required" => false,
)
)
->add(
'selection_postscriptum',
TextareaType::class,
array(
'attr' => array('class' => 'tinymce'),
"constraints" => [],
"label" => Translator::getInstance()->trans('Conclusion', [], Selection::DOMAIN_NAME),
"required" => false,
)
);
//instead of option value, symfony take option key!
//these 2 event listeners are a hack
$this->formBuilder->addEventListener(
FormEvents::SUBMIT,
function (FormEvent $event) {
$data = $event->getData();
$selectionContainerWrongValue = $data['selection_container'];
$selectionContainerValue = $this->containersArray[$selectionContainerWrongValue];
$data['selection_container_id'] = $selectionContainerValue;
$event->setData($data);
}
);
$this->formBuilder->addEventListener(
FormEvents::PRE_SET_DATA,
function (FormEvent $event) {
$data = $event->getData();
if (!array_key_exists('selection_container', $data)) {
return;
}
$key = array_search($data['selection_container'], $this->containersArray);
$data['selection_container'] = $key;
$event->setData($data);
}
);
}
public function checkDuplicateCode($value, ExecutionContextInterface $context)
{
$data = $context->getRoot()->getData();
$count = SelectionQuery::create()
->filterById($data['selection_id'], Criteria::NOT_EQUAL)
->filterByCode($value)->count();
if ($count > 0) {
$context->addViolation(
Translator::getInstance()->trans(
"A selection with code %code already exists. Please enter a different code.",
array('%code' => $value)
)
);
}
}
/**
* @return string the name of the form. This name need to be unique.
*/
public function getName()
{
return "admin_selection_update";
}
private function initContainers()
{
$lang = $this->request->getSession() ? $this->request->getSession()->getLang(true) : $this->request->lang = Lang::getDefaultLanguage();
$containers = SelectionContainerQuery::getAll($lang);
$this->containersArray = [];
$this->containersArray[Translator::getInstance()->trans('None', [], Selection::DOMAIN_NAME)] = null; //because placeholder is not working
foreach ($containers as $container) {
try {
$this->containersArray[$container->getVirtualColumn("i18n_TITLE")] = $container->getId();
} catch (PropelException $e) {
Tlog::getInstance()->error($e->getMessage());
}
}
}
}

View File

@@ -0,0 +1,15 @@
<?php
/**
* Created by PhpStorm.
* User: audreymartel
* Date: 10/07/2018
* Time: 12:20
*/
namespace Selection\Form;
class SelectioncontainerImageModification
{
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Selection\Hook;
use Selection\Selection;
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
use Thelia\Core\Hook\BaseHook;
use Thelia\Tools\URL;
/***
* Class BackHook
* @package Selection\Hook
* @author Maxime Bruchet <mbruchet@openstudio.fr>
*/
class BackHook extends BaseHook
{
/***
* Hook Selection module to the sidebar in tools menu
*
* @param HookRenderBlockEvent $event
*/
public function onMainTopMenuTools(HookRenderBlockEvent $event)
{
$event->add(
[
'id' => 'tools_menu_selection',
'class' => '',
'url' => URL::getInstance()->absoluteUrl('/admin/selection'),
'title' => $this->trans('Selections', [], Selection::DOMAIN_NAME)
]
);
}
}

View File

@@ -0,0 +1,75 @@
<?php
return array(
'(Modification)' => '(Modification)',
'Actions' => 'Actions',
'Add a new Selection' => 'Ajouter une nouvelle sélection',
'Add a new selection Container' => 'Ajout d\'un nouveau conteneur de sélection',
'Add a selection to this container' => 'Ajouter une selection à ce conteneur',
'Back' => 'Retour',
'Browse files' => 'Rechercher des fichiers',
'Can\'t load images, please refresh this page.' => 'Chargement des images impossible, veuillez actualiser la page',
'Can\'t reorder images, please refresh this page.' => 'Classement des images impossible, veuillez actualiser la page',
'Change this selection' => 'Changer cette sélection',
'Container' => 'Conteneur',
'Content title' => 'Titre du contenu',
'Create a Selection Container' => 'Créer un conteneur de sélection',
'Delete selection' => 'Supprimer une sélection',
'Delete selection container' => 'Supprimer le conteneur de sélection',
'Delete this selection' => 'Supprimer cette sélection',
'Delete this value' => 'Supprimer cette valeur',
'Display selections in this container' => 'Afficher les selections du conteneur ',
'Do you really want to delete these %count image(s) ?' => 'Voulez-vous vraiment supprimer cette/ces %count image(s)?',
'Do you really want to delete this container?' => 'Voulez-vous vraiment supprimer ce conteneur?',
'Do you really want to delete this image ?' => 'Voulez-vous vraiment supprimer cette image?',
'Do you really want to delete this selection ?' => 'Etes-vous sûr de vouloir supprimer cette sélection?',
'Drop files to upload' => 'Déposer des fichiers pour les uploader',
'Edit an image' => 'Editer une image',
'Edit image "%name"' => 'Editer l\'image "%name" ',
'Edit selection' => 'Édition Sélection',
'Edit selection container' => 'Éditer le conteneur de sélection',
'Editing image "%name"' => 'Édition de l\'image "%name" ',
'Enter new product position' => 'Entrer la nouvelle position du produit',
'General' => 'Général',
'Home' => 'Accueil',
'ID' => 'ID',
'Image' => 'Image',
'Image information' => 'Image information ',
'Image+file+not+found' => 'Fichier+image+non+trouvé',
'No' => 'Non',
'No available content in this folder' => 'Aucun contenu disponible dans ce dossier',
'No available product in this category' => 'Aucun produit disponible pour cette catégorie',
'Online' => 'En ligne',
'Or' => 'Ou',
'Please retry' => 'Veuillez ré-essayer',
'Position' => 'Position',
'Preview' => 'Apperçu',
'Product title' => 'Titre du produit',
'Related content' => 'Contenus associés',
'SEO' => 'SEO',
'Save' => 'Enregistrer',
'Select a category to get its product' => 'Sélectionner une catégorie pour afficher ces produits',
'Select a category...' => 'Sélectionner une catégorie...',
'Select a folder to get its content' => 'Sélectionner un dossier pour afficher son contenu',
'Select a folder...' => 'Sélectionner un dossier...',
'Select a product and click (+) to add it as an accessory' => 'Sélectionner un produit et cliquer (+) pour l\'ajouter comme accessoire',
'Select a product...' => 'Sélectionner un produit...',
'Selection' => 'Sélection',
'Selection category' => 'Produits dans la sélection',
'Selection container edit :' => 'Conteneur de sélection - Edition ',
'Selection edit :' => 'Sélection édition :',
'Selections' => 'Sélections',
'Selections Containers' => 'Conteneur de sélection',
'Selections without container' => 'Sélection(s) sans conteneur',
'Send files' => 'Envoyer les fichiers',
'Sorry, image ID=%id was not found.' => 'Désolé, l\'image ID=%id n\'a pas été trouvée',
'There is no images attached to this %type.' => 'Aucune images attachée à ce %type',
'Title' => 'Titre',
'Tools' => 'Outils',
'Update this image' => 'Mettre à jour cette image',
'Visibility' => 'Visibilité',
'Yes' => 'Oui',
'You can attach here some category to this selection' => 'Indiquez ici les produits qui figurent dans cette sélection',
'You can attach here some contents to this selection' => 'Attacher ici des contenus à la sélection',
'delete image' => 'Supprimer l\'image',
);

View File

@@ -0,0 +1,4 @@
<?php
return array(
// 'an english string' => 'The displayed english string',
);

View File

@@ -0,0 +1,13 @@
<?php
return array(
'Conclusion' => 'Conclusion',
'Container' => 'Conteneur',
'Description' => 'Description',
'Selection' => 'Sélection',
'Selection code' => 'Code de la sélection',
'Selection reference' => 'Référence de la sélection',
'Summary' => 'Résumé',
'Title' => 'Titre',
'Selections' => 'Séléctions',
);

View File

@@ -0,0 +1,230 @@
<?php
/**
* Created by PhpStorm.
* User: audreymartel
* Date: 09/07/2018
* Time: 12:39
*/
namespace Selection\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Exception\PropelException;
use Selection\Model\Map\SelectionContainerAssociatedSelectionTableMap;
use Selection\Model\SelectionContainer;
use Selection\Model\SelectionContainerAssociatedSelectionQuery;
use Selection\Model\SelectionContainerQuery;
use Selection\Model\SelectionI18nQuery;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Log\Tlog;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
use Thelia\Type\TypeCollection;
/**
* Class SelectionContainerLoop
* @package Selection\Loop
* @method int[] getExclude()
* @method int[] getId()
* @method int getSelectionId()
* @method string[] getExcludeCode()
* @method string[] getCode()
* @method string getTitle()
* @method int[] getPosition()
* @method bool|string getVisible()
*/
class SelectionContainerLoop extends BaseI18nLoop implements PropelSearchLoopInterface
{
/***
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createAnyListTypeArgument('code'),
Argument::createAnyListTypeArgument('exclude_code'),
Argument::createIntTypeArgument('selection_id'),
Argument::createBooleanTypeArgument('need_selection_count'),
Argument::createBooleanOrBothTypeArgument('visible', true),
Argument::createAnyTypeArgument('title'),
Argument::createIntListTypeArgument('position'),
Argument::createIntListTypeArgument('exclude'),
new Argument(
'order',
new TypeCollection(
new Type\EnumListType(array(
'id', 'id_reverse',
'code', 'code_reverse',
'alpha', 'alpha_reverse',
'manual', 'manual_reverse',
'visible', 'visible_reverse',
'created', 'created_reverse',
'updated', 'updated_reverse',
'random'
))
),
'manual'
)
);
}
public function buildModelCriteria()
{
$search = SelectionContainerQuery::create();
/* manage translations */
$this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION'));
if (null !== $code = $this->getCode()) {
$search->filterByCode($code, Criteria::IN);
}
if (null !== $excludeCode = $this->getExcludeCode()) {
$search->filterByCode($excludeCode, Criteria::NOT_IN);
}
if (null !== $exclude = $this->getExclude()) {
$search->filterById($exclude, Criteria::NOT_IN);
}
if (null !== $id = $this->getId()) {
$search->filterById($id, Criteria::IN);
}
if (null !== $position = $this->getPosition()) {
$search->filterByPosition($position, Criteria::IN);
}
if (null !== $title = $this->getTitle()) {
//find all selections that match exactly this title and find with all locales.
try {
$search2 = SelectionI18nQuery::create()
->filterByTitle($title, Criteria::LIKE)
->select('id')
->find();
if ($search2) {
$search->filterById(
$search2,
Criteria::IN
);
}
} catch (PropelException $e) {
Tlog::getInstance()->error($e->getMessage());
}
}
$visible = $this->getVisible();
if (BooleanOrBothType::ANY !== $visible) {
$search->filterByVisible($visible ? 1 : 0);
}
if (null !== $selectionId = $this->getSelectionId()) {
$search->innerJoinSelectionContainerAssociatedSelection(SelectionContainerAssociatedSelectionTableMap::TABLE_NAME);
$search->where(SelectionContainerAssociatedSelectionTableMap::SELECTION_ID . Criteria::EQUAL . $selectionId);
}
/** @noinspection PhpUndefinedMethodInspection */
$orders = $this->getOrder();
foreach ($orders as $order) {
switch ($order) {
case "id":
$search->orderById(Criteria::ASC);
break;
case "id_reverse":
$search->orderById(Criteria::DESC);
break;
case "code":
$search->orderByCode(Criteria::ASC);
break;
case "code_reverse":
$search->orderByCode(Criteria::DESC);
break;
case "alpha":
$search->addAscendingOrderByColumn('i18n_TITLE');
break;
case "alpha_reverse":
$search->addDescendingOrderByColumn('i18n_TITLE');
break;
case "manual":
$search->orderByPosition(Criteria::ASC);
break;
case "manual_reverse":
$search->orderByPosition(Criteria::DESC);
break;
case "visible":
$search->orderByVisible(Criteria::ASC);
break;
case "visible_reverse":
$search->orderByVisible(Criteria::DESC);
break;
case "created":
$search->addAscendingOrderByColumn('created_at');
break;
case "created_reverse":
$search->addDescendingOrderByColumn('created_at');
break;
case "updated":
$search->addAscendingOrderByColumn('updated_at');
break;
case "updated_reverse":
$search->addDescendingOrderByColumn('updated_at');
break;
case "random":
$search->clearOrderByColumns();
$search->addAscendingOrderByColumn('RAND()');
break;
default:
$search->orderByPosition(Criteria::ASC);
}
}
return $search;
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @noinspection PhpUndefinedMethodInspection */
$needSelectionCount = $this->getNeedSelectionCount() === null || !$this->getNeedSelectionCount();
/** @var SelectionContainer $selectionContainer */
foreach ($loopResult->getResultDataCollection() as $selectionContainer) {
$loopResultRow = new LoopResultRow($selectionContainer);
/** @noinspection PhpUndefinedMethodInspection */
$loopResultRow
->set("SELECTION_CONTAINER_ID", $selectionContainer->getId())
->set("SELECTION_CONTAINER_URL", $this->getReturnUrl() ? $selectionContainer->getUrl($this->locale) : null)
->set("SELECTION_CONTAINER_CODE", $selectionContainer->getCode())
->set("SELECTION_CONTAINER_TITLE", $selectionContainer->geti18n_TITLE())
->set("SELECTION_CONTAINER_META_TITLE", $selectionContainer->geti18n_META_TITLE())
->set("SELECTION_CONTAINER_POSITION", $selectionContainer->getPosition())
->set("SELECTION_CONTAINER_VISIBLE", $selectionContainer->getVisible())
->set("SELECTION_CONTAINER_DESCRIPTION", $selectionContainer->geti18n_DESCRIPTION())
->set("SELECTION_CONTAINER_META_DESCRIPTION", $selectionContainer->geti18n_META_DESCRIPTION())
->set("SELECTION_CONTAINER_POSTSCRIPTUM", $selectionContainer->geti18n_POSTSCRIPTUM())
->set("SELECTION_CONTAINER_CHAPO", $selectionContainer->geti18n_CHAPO());
if ($needSelectionCount) {
$associatedSelectionsQuery = SelectionContainerAssociatedSelectionQuery::create();
$associatedSelectionsQuery->filterBySelectionContainerId($selectionContainer->getId());
$childCount = $associatedSelectionsQuery->find()->count();
$loopResultRow->set("SELECTION_COUNT", $childCount);
}
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace Selection\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Selection\Model\Map\SelectionContentTableMap;
use Selection\Model\SelectionContent;
use Selection\Model\SelectionContentQuery;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\Map\ContentI18nTableMap;
class SelectionContentRelated extends BaseLoop implements PropelSearchLoopInterface
{
public $countable = true;
public $timestampable = false;
public $versionable = false;
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('content_id'),
Argument::createIntListTypeArgument('selection_id'),
Argument::createAnyTypeArgument('content_title'),
Argument::createIntListTypeArgument('position')
);
}
/**
* @return \Propel\Runtime\ActiveQuery\ModelCriteria|SelectionContentQuery
* @throws \Propel\Runtime\Exception\PropelException
*/
public function buildModelCriteria()
{
$search = SelectionContentQuery::create();
if (null !== $content_id = $this->getContentId()) {
$search->filterByContentId($content_id, Criteria::IN);
}
if (null !== $position = $this->getPosition()) {
$search->filterByPosition($position, Criteria::IN);
}
if (null !== $selection_id = $this->getSelectionId()) {
$search->filterBySelectionId($selection_id, Criteria::IN);
}
if (null !== $content_title = $this->getContentTitle()) {
$join = new Join(
ContentI18nTableMap::ID,
SelectionContentTableMap::CONTENT_ID,
Criteria::INNER_JOIN
);
$search->addJoinObject($join, 'search')
->addJoinCondition('search', ContentI18nTableMap::TITLE."=". $content_title);
}
return $search->orderByPosition(Criteria::ASC);
}
/**
* @param LoopResult $loopResult
* @return LoopResult
* @throws \Propel\Runtime\Exception\PropelException
*/
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $content) {
/** @var SelectionContent $content */
$loopResultRow = new LoopResultRow($content);
$lang = $this->request->getSession()->get('thelia.current.lang');
$loopResultRow
->set("CONTENT_ID", $content->getContentId())
->set("CONTENT_TITLE", $content->getContent()->getTitle())
->set("POSITION", $content->getPosition())
->set("selection_id", $content->getSelectionId());
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace Selection\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Image;
class SelectionImage extends Image implements PropelSearchLoopInterface
{
/**
* @param string $source
* @param int $object_id
* @return mixed|\Propel\Runtime\ActiveQuery\ModelCriteria
* @throws \ReflectionException
*/
protected function createSearchQuery($source, $object_id)
{
$object = ucfirst($source);
$ns = 'Selection\Model';
if ('\\' !== $ns[0]) {
$ns = '\\'.$ns;
}
$queryClass = sprintf("%s\\%sImageQuery", $ns, $object);
$filterMethod = sprintf("filterBy%sId", $object);
// xxxImageQuery::create()
$method = new \ReflectionMethod($queryClass, 'create');
$search = $method->invoke(null); // Static !
// $query->filterByXXX(id)
if (! is_null($object_id)) {
$method = new \ReflectionMethod($queryClass, $filterMethod);
$method->invoke($search, $object_id);
}
$orders = $this->getOrder();
// Results ordering
foreach ($orders as $order) {
switch ($order) {
case "alpha":
$search->addAscendingOrderByColumn('i18n_TITLE');
break;
case "alpha-reverse":
$search->addDescendingOrderByColumn('i18n_TITLE');
break;
case "manual-reverse":
$search->orderByPosition(Criteria::DESC);
break;
case "manual":
$search->orderByPosition(Criteria::ASC);
break;
case "random":
$search->clearOrderByColumns();
$search->addAscendingOrderByColumn('RAND()');
break(2);
break;
}
}
return $search;
}
}

View File

@@ -0,0 +1,231 @@
<?php
namespace Selection\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Exception\PropelException;
use Selection\Model\Map\SelectionContainerAssociatedSelectionTableMap;
use Selection\Model\Selection;
use Selection\Model\SelectionI18nQuery;
use Selection\Model\SelectionQuery;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
use Thelia\Type\TypeCollection;
/**
* Class SelectionLoop
*
* @package Thelia\Core\Template\Loop
*
* {@inheritdoc}
* @method int[] getExclude()
* @method int[] getId()
* @method string[] getExcludeCode()
* @method string[] getCode()
* @method string getTitle()
* @method int[] getPosition()
* @method bool|string getVisible()
*/
class SelectionLoop extends BaseI18nLoop implements PropelSearchLoopInterface
{
public $countable = true;
public $timestampable = false;
public $versionable = false;
/***
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createAnyListTypeArgument('code'),
Argument::createAnyListTypeArgument('exclude_code'),
Argument::createIntTypeArgument('container_id'),
Argument::createBooleanTypeArgument('without_container'),
Argument::createBooleanOrBothTypeArgument('visible', true),
Argument::createAnyTypeArgument('title'),
Argument::createIntListTypeArgument('position'),
Argument::createIntListTypeArgument('exclude'),
new Argument(
'order',
new TypeCollection(
new Type\EnumListType(array(
'id', 'id_reverse',
'code', 'code_reverse',
'alpha', 'alpha_reverse',
'manual', 'manual_reverse',
'visible', 'visible_reverse',
'created', 'created_reverse',
'updated', 'updated_reverse',
'random'
))
),
'manual'
)
);
}
/**
* @return \Propel\Runtime\ActiveQuery\ModelCriteria|SelectionQuery
* @throws \Propel\Runtime\Exception\PropelException
*/
public function buildModelCriteria()
{
$search = SelectionQuery::create();
/* manage translations */
$this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION'));
if (null !== $code = $this->getCode()) {
$search->filterByCode($code, Criteria::IN);
}
if (null !== $excludeCode = $this->getExcludeCode()) {
$search->filterByCode($excludeCode, Criteria::NOT_IN);
}
if (null !== $exclude = $this->getExclude()) {
$search->filterById($exclude, Criteria::NOT_IN);
}
if (null !== $id = $this->getId()) {
$search->filterById($id, Criteria::IN);
}
if (null !== $position = $this->getPosition()) {
$search->filterByPosition($position, Criteria::IN);
}
if (null !== $title = $this->getTitle()) {
//find all selections that match exactly this title and find with all locales.
$search2 = SelectionI18nQuery::create()
->filterByTitle($title, Criteria::LIKE)
->select('id')
->find();
if ($search2) {
$search->filterById(
$search2,
Criteria::IN
);
}
}
$visible = $this->getVisible();
if (BooleanOrBothType::ANY !== $visible) {
$search->filterByVisible($visible ? 1 : 0);
}
$search->leftJoinSelectionContainerAssociatedSelection(SelectionContainerAssociatedSelectionTableMap::TABLE_NAME);
/** @noinspection PhpUndefinedMethodInspection */
$wantedContainerId = $this->getContainerId();
/** @noinspection PhpUndefinedMethodInspection */
$withoutContainer = $this->getWithoutContainer();
if (null !== $wantedContainerId) {
$search->leftJoinSelectionContainerAssociatedSelection(SelectionContainerAssociatedSelectionTableMap::TABLE_NAME);
$search->where(SelectionContainerAssociatedSelectionTableMap::SELECTION_CONTAINER_ID . Criteria::EQUAL . $wantedContainerId);
} else if (null !== $withoutContainer && $withoutContainer) {
$search->leftJoinSelectionContainerAssociatedSelection(SelectionContainerAssociatedSelectionTableMap::TABLE_NAME);
$search->where(SelectionContainerAssociatedSelectionTableMap::SELECTION_ID . Criteria::ISNULL);
}
/** @noinspection PhpUndefinedMethodInspection */
$orders = $this->getOrder();
foreach ($orders as $order) {
switch ($order) {
case "id":
$search->orderById(Criteria::ASC);
break;
case "id_reverse":
$search->orderById(Criteria::DESC);
break;
case "code":
$search->orderByCode(Criteria::ASC);
break;
case "code_reverse":
$search->orderByCode(Criteria::DESC);
break;
case "alpha":
$search->addAscendingOrderByColumn('i18n_TITLE');
break;
case "alpha_reverse":
$search->addDescendingOrderByColumn('i18n_TITLE');
break;
case "manual":
$search->orderByPosition(Criteria::ASC);
break;
case "manual_reverse":
$search->orderByPosition(Criteria::DESC);
break;
case "visible":
$search->orderByVisible(Criteria::ASC);
break;
case "visible_reverse":
$search->orderByVisible(Criteria::DESC);
break;
case "created":
$search->addAscendingOrderByColumn('created_at');
break;
case "created_reverse":
$search->addDescendingOrderByColumn('created_at');
break;
case "updated":
$search->addAscendingOrderByColumn('updated_at');
break;
case "updated_reverse":
$search->addDescendingOrderByColumn('updated_at');
break;
case "random":
$search->clearOrderByColumns();
$search->addAscendingOrderByColumn('RAND()');
break;
default:
$search->orderByPosition(Criteria::ASC);
}
}
return $search;
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
* @throws PropelException
*/
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $selection) {
/** @var Selection $selection */
$loopResultRow = new LoopResultRow($selection);
/** @noinspection PhpUndefinedMethodInspection */
$loopResultRow
->set("SELECTION_ID", $selection->getId())
->set("SELECTION_URL", $this->getReturnUrl() ? $selection->getUrl($this->locale) : null)
->set("SELECTION_TITLE", $selection->geti18n_TITLE())
->set("SELECTION_CODE", $selection->getCode())
->set("SELECTION_META_TITLE", $selection->geti18n_META_TITLE())
->set("SELECTION_POSITION", $selection->getPosition())
->set("SELECTION_VISIBLE", $selection->getVisible())
->set("SELECTION_DESCRIPTION", $selection->geti18n_DESCRIPTION())
->set("SELECTION_META_DESCRIPTION", $selection->geti18n_META_DESCRIPTION())
->set("SELECTION_POSTSCRIPTUM", $selection->geti18n_POSTSCRIPTUM())
->set("SELECTION_CHAPO", $selection->geti18n_CHAPO())
->set("SELECTION_CONTAINER_ID", $selection->getSelectionContainerAssociatedSelections())
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace Selection\Loop;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\Category;
use Thelia\Model\CategoryDocumentI18nQuery;
use Thelia\Model\CategoryQuery;
class SelectionLoopCategory extends BaseLoop implements PropelSearchLoopInterface
{
public $countable = true;
public $timestampable = false;
public $versionable = false;
/***
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('category_id'),
Argument::createAnyTypeArgument('category_title')
);
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$search = CategoryQuery::create();
if (null !== $category_id = $this->getCategoryId()) {
$search->filterById();
}
if (null !== $category_title = $this->getCategoryTitle()) {
$title = CategoryDocumentI18nQuery::create();
$title->filterByTitle();
}
return $search;
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $category) {
/** @var Category $category */
$loopResultRow = new LoopResultRow($category);
$lang = $this->request->getSession()->get('thelia.current.lang');
$loopResultRow
->set("CATEGORY_ID", $category->getId())
->set("CATEGORY_TITLE", $category->getTranslation($lang->getLocale())->getTitle());
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace Selection\Loop;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\Folder;
use Thelia\Model\FolderI18nQuery;
use Thelia\Model\FolderQuery;
class SelectionLoopFolder extends BaseLoop implements PropelSearchLoopInterface
{
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('folder_id'),
Argument::createAnyTypeArgument('folder_title')
);
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$search = FolderQuery::create();
if (null !== $folder_id = $this->getFolderId()) {
$search->filterById();
}
if (null !== $folder_title = $this->getFolderTitle()) {
$title = FolderI18nQuery::create();
$title->filterByTitle();
}
return $search;
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $folder) {
/** @var Folder $folder */
$loopResultRow = new LoopResultRow($folder);
$lang = $this->request->getSession()->get('thelia.current.lang');
$loopResultRow
->set('folder_id', $folder->getId())
->set('folder_title', $folder->getTranslation($lang->getLocale())->getTitle());
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,102 @@
<?php
namespace Selection\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\Join;
use Selection\Model\Map\SelectionContentTableMap;
use Selection\Model\SelectionProduct;
use Selection\Model\SelectionProductQuery;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\Map\ProductI18nTableMap;
/**
* Class SelectionProductRelated
*
* @package Thelia\Core\Template\Loop
*
* {@inheritdoc}
* @method int[] getProductId()
* @method int[] getSelectionId()
* @method string getProductTitle()
* @method int[] getPosition()
*/
class SelectionProductRelated extends BaseLoop implements PropelSearchLoopInterface
{
public $countable = true;
public $timestampable = false;
public $versionable = false;
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('product_id'),
Argument::createAnyTypeArgument('product_title'),
Argument::createIntListTypeArgument('selection_id'),
Argument::createIntListTypeArgument('position')
);
}
/**
* @return \Propel\Runtime\ActiveQuery\ModelCriteria|SelectionProductQuery
* @throws \Propel\Runtime\Exception\PropelException
*/
public function buildModelCriteria()
{
$search = SelectionProductQuery::create();
if (null !== $product_id = $this->getProductID()) {
$search->filterByProductId($product_id, Criteria::IN);
}
if (null !== $selection_id = $this->getSelectionId()) {
$search->filterBySelectionId($selection_id, Criteria::IN);
}
if (null !== $position = $this->getPosition()) {
$search->filterByPosition($position, Criteria::IN);
}
if (null !== $product_title = $this->getProductTitle()) {
$join = new Join(
ProductI18nTableMap::ID,
SelectionContentTableMap::CONTENT_ID,
Criteria::INNER_JOIN
);
$search->addJoinObject($join, 'search')
->addJoinCondition('search', ProductI18nTableMap::TITLE."=". $product_title);
}
return $search->orderByPosition(Criteria::ASC);
}
/**
* @param LoopResult $loopResult
* @return LoopResult
* @throws \Propel\Runtime\Exception\PropelException
*/
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $product) {
/** @var SelectionProduct $product */
$loopResultRow = new LoopResultRow($product);
$lang = $this->request->getSession()->get('thelia.current.lang');
$loopResultRow
->set("PRODUCT_ID", $product->getProductId())
->set("PRODUCT_TITLE", $product->getProduct()->getTitle())
->set("POSITION", $product->getPosition())
->set("selection_id", $product->getSelectionId());
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,759 @@
<?php
namespace Selection\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 Selection\Model\SelectionContainerAssociatedSelection as ChildSelectionContainerAssociatedSelection;
use Selection\Model\SelectionContainerAssociatedSelectionQuery as ChildSelectionContainerAssociatedSelectionQuery;
use Selection\Model\Map\SelectionContainerAssociatedSelectionTableMap;
/**
* Base class that represents a query for the 'selection_container_associated_selection' table.
*
*
*
* @method ChildSelectionContainerAssociatedSelectionQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSelectionContainerAssociatedSelectionQuery orderBySelectionContainerId($order = Criteria::ASC) Order by the selection_container_id column
* @method ChildSelectionContainerAssociatedSelectionQuery orderBySelectionId($order = Criteria::ASC) Order by the selection_id column
* @method ChildSelectionContainerAssociatedSelectionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildSelectionContainerAssociatedSelectionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildSelectionContainerAssociatedSelectionQuery groupById() Group by the id column
* @method ChildSelectionContainerAssociatedSelectionQuery groupBySelectionContainerId() Group by the selection_container_id column
* @method ChildSelectionContainerAssociatedSelectionQuery groupBySelectionId() Group by the selection_id column
* @method ChildSelectionContainerAssociatedSelectionQuery groupByCreatedAt() Group by the created_at column
* @method ChildSelectionContainerAssociatedSelectionQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildSelectionContainerAssociatedSelectionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSelectionContainerAssociatedSelectionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSelectionContainerAssociatedSelectionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSelectionContainerAssociatedSelectionQuery leftJoinSelectionContainer($relationAlias = null) Adds a LEFT JOIN clause to the query using the SelectionContainer relation
* @method ChildSelectionContainerAssociatedSelectionQuery rightJoinSelectionContainer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SelectionContainer relation
* @method ChildSelectionContainerAssociatedSelectionQuery innerJoinSelectionContainer($relationAlias = null) Adds a INNER JOIN clause to the query using the SelectionContainer relation
*
* @method ChildSelectionContainerAssociatedSelectionQuery leftJoinSelection($relationAlias = null) Adds a LEFT JOIN clause to the query using the Selection relation
* @method ChildSelectionContainerAssociatedSelectionQuery rightJoinSelection($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Selection relation
* @method ChildSelectionContainerAssociatedSelectionQuery innerJoinSelection($relationAlias = null) Adds a INNER JOIN clause to the query using the Selection relation
*
* @method ChildSelectionContainerAssociatedSelection findOne(ConnectionInterface $con = null) Return the first ChildSelectionContainerAssociatedSelection matching the query
* @method ChildSelectionContainerAssociatedSelection findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSelectionContainerAssociatedSelection matching the query, or a new ChildSelectionContainerAssociatedSelection object populated from the query conditions when no match is found
*
* @method ChildSelectionContainerAssociatedSelection findOneById(int $id) Return the first ChildSelectionContainerAssociatedSelection filtered by the id column
* @method ChildSelectionContainerAssociatedSelection findOneBySelectionContainerId(int $selection_container_id) Return the first ChildSelectionContainerAssociatedSelection filtered by the selection_container_id column
* @method ChildSelectionContainerAssociatedSelection findOneBySelectionId(int $selection_id) Return the first ChildSelectionContainerAssociatedSelection filtered by the selection_id column
* @method ChildSelectionContainerAssociatedSelection findOneByCreatedAt(string $created_at) Return the first ChildSelectionContainerAssociatedSelection filtered by the created_at column
* @method ChildSelectionContainerAssociatedSelection findOneByUpdatedAt(string $updated_at) Return the first ChildSelectionContainerAssociatedSelection filtered by the updated_at column
*
* @method array findById(int $id) Return ChildSelectionContainerAssociatedSelection objects filtered by the id column
* @method array findBySelectionContainerId(int $selection_container_id) Return ChildSelectionContainerAssociatedSelection objects filtered by the selection_container_id column
* @method array findBySelectionId(int $selection_id) Return ChildSelectionContainerAssociatedSelection objects filtered by the selection_id column
* @method array findByCreatedAt(string $created_at) Return ChildSelectionContainerAssociatedSelection objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildSelectionContainerAssociatedSelection objects filtered by the updated_at column
*
*/
abstract class SelectionContainerAssociatedSelectionQuery extends ModelCriteria
{
/**
* Initializes internal state of \Selection\Model\Base\SelectionContainerAssociatedSelectionQuery 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 = '\\Selection\\Model\\SelectionContainerAssociatedSelection', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSelectionContainerAssociatedSelectionQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSelectionContainerAssociatedSelectionQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Selection\Model\SelectionContainerAssociatedSelectionQuery) {
return $criteria;
}
$query = new \Selection\Model\SelectionContainerAssociatedSelectionQuery();
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 ChildSelectionContainerAssociatedSelection|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SelectionContainerAssociatedSelectionTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(SelectionContainerAssociatedSelectionTableMap::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 ChildSelectionContainerAssociatedSelection A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, SELECTION_CONTAINER_ID, SELECTION_ID, CREATED_AT, UPDATED_AT FROM selection_container_associated_selection 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 ChildSelectionContainerAssociatedSelection();
$obj->hydrate($row);
SelectionContainerAssociatedSelectionTableMap::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 ChildSelectionContainerAssociatedSelection|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 ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::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 ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::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 ChildSelectionContainerAssociatedSelectionQuery 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(SelectionContainerAssociatedSelectionTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the selection_container_id column
*
* Example usage:
* <code>
* $query->filterBySelectionContainerId(1234); // WHERE selection_container_id = 1234
* $query->filterBySelectionContainerId(array(12, 34)); // WHERE selection_container_id IN (12, 34)
* $query->filterBySelectionContainerId(array('min' => 12)); // WHERE selection_container_id > 12
* </code>
*
* @see filterBySelectionContainer()
*
* @param mixed $selectionContainerId 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 ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function filterBySelectionContainerId($selectionContainerId = null, $comparison = null)
{
if (is_array($selectionContainerId)) {
$useMinMax = false;
if (isset($selectionContainerId['min'])) {
$this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::SELECTION_CONTAINER_ID, $selectionContainerId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($selectionContainerId['max'])) {
$this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::SELECTION_CONTAINER_ID, $selectionContainerId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::SELECTION_CONTAINER_ID, $selectionContainerId, $comparison);
}
/**
* Filter the query on the selection_id column
*
* Example usage:
* <code>
* $query->filterBySelectionId(1234); // WHERE selection_id = 1234
* $query->filterBySelectionId(array(12, 34)); // WHERE selection_id IN (12, 34)
* $query->filterBySelectionId(array('min' => 12)); // WHERE selection_id > 12
* </code>
*
* @see filterBySelection()
*
* @param mixed $selectionId 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 ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function filterBySelectionId($selectionId = null, $comparison = null)
{
if (is_array($selectionId)) {
$useMinMax = false;
if (isset($selectionId['min'])) {
$this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::SELECTION_ID, $selectionId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($selectionId['max'])) {
$this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::SELECTION_ID, $selectionId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::SELECTION_ID, $selectionId, $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 ChildSelectionContainerAssociatedSelectionQuery 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(SelectionContainerAssociatedSelectionTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::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 ChildSelectionContainerAssociatedSelectionQuery 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(SelectionContainerAssociatedSelectionTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Selection\Model\SelectionContainer object
*
* @param \Selection\Model\SelectionContainer|ObjectCollection $selectionContainer The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function filterBySelectionContainer($selectionContainer, $comparison = null)
{
if ($selectionContainer instanceof \Selection\Model\SelectionContainer) {
return $this
->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::SELECTION_CONTAINER_ID, $selectionContainer->getId(), $comparison);
} elseif ($selectionContainer instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::SELECTION_CONTAINER_ID, $selectionContainer->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySelectionContainer() only accepts arguments of type \Selection\Model\SelectionContainer or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SelectionContainer relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function joinSelectionContainer($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SelectionContainer');
// 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, 'SelectionContainer');
}
return $this;
}
/**
* Use the SelectionContainer relation SelectionContainer 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 \Selection\Model\SelectionContainerQuery A secondary query class using the current class as primary query
*/
public function useSelectionContainerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSelectionContainer($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SelectionContainer', '\Selection\Model\SelectionContainerQuery');
}
/**
* Filter the query by a related \Selection\Model\Selection object
*
* @param \Selection\Model\Selection|ObjectCollection $selection The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function filterBySelection($selection, $comparison = null)
{
if ($selection instanceof \Selection\Model\Selection) {
return $this
->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::SELECTION_ID, $selection->getId(), $comparison);
} elseif ($selection instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::SELECTION_ID, $selection->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySelection() only accepts arguments of type \Selection\Model\Selection or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Selection relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function joinSelection($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Selection');
// 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, 'Selection');
}
return $this;
}
/**
* Use the Selection relation Selection 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 \Selection\Model\SelectionQuery A secondary query class using the current class as primary query
*/
public function useSelectionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSelection($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Selection', '\Selection\Model\SelectionQuery');
}
/**
* Exclude object from result
*
* @param ChildSelectionContainerAssociatedSelection $selectionContainerAssociatedSelection Object to remove from the list of results
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function prune($selectionContainerAssociatedSelection = null)
{
if ($selectionContainerAssociatedSelection) {
$this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::ID, $selectionContainerAssociatedSelection->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the selection_container_associated_selection 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(SelectionContainerAssociatedSelectionTableMap::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).
SelectionContainerAssociatedSelectionTableMap::clearInstancePool();
SelectionContainerAssociatedSelectionTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSelectionContainerAssociatedSelection or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSelectionContainerAssociatedSelection 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(SelectionContainerAssociatedSelectionTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SelectionContainerAssociatedSelectionTableMap::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();
SelectionContainerAssociatedSelectionTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SelectionContainerAssociatedSelectionTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(SelectionContainerAssociatedSelectionTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionContainerAssociatedSelectionTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionContainerAssociatedSelectionTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionContainerAssociatedSelectionTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildSelectionContainerAssociatedSelectionQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionContainerAssociatedSelectionTableMap::CREATED_AT);
}
} // SelectionContainerAssociatedSelectionQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,706 @@
<?php
namespace Selection\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 Selection\Model\SelectionContainerI18n as ChildSelectionContainerI18n;
use Selection\Model\SelectionContainerI18nQuery as ChildSelectionContainerI18nQuery;
use Selection\Model\Map\SelectionContainerI18nTableMap;
/**
* Base class that represents a query for the 'selection_container_i18n' table.
*
*
*
* @method ChildSelectionContainerI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSelectionContainerI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildSelectionContainerI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildSelectionContainerI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildSelectionContainerI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildSelectionContainerI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ChildSelectionContainerI18nQuery orderByMetaTitle($order = Criteria::ASC) Order by the meta_title column
* @method ChildSelectionContainerI18nQuery orderByMetaDescription($order = Criteria::ASC) Order by the meta_description column
* @method ChildSelectionContainerI18nQuery orderByMetaKeywords($order = Criteria::ASC) Order by the meta_keywords column
*
* @method ChildSelectionContainerI18nQuery groupById() Group by the id column
* @method ChildSelectionContainerI18nQuery groupByLocale() Group by the locale column
* @method ChildSelectionContainerI18nQuery groupByTitle() Group by the title column
* @method ChildSelectionContainerI18nQuery groupByDescription() Group by the description column
* @method ChildSelectionContainerI18nQuery groupByChapo() Group by the chapo column
* @method ChildSelectionContainerI18nQuery groupByPostscriptum() Group by the postscriptum column
* @method ChildSelectionContainerI18nQuery groupByMetaTitle() Group by the meta_title column
* @method ChildSelectionContainerI18nQuery groupByMetaDescription() Group by the meta_description column
* @method ChildSelectionContainerI18nQuery groupByMetaKeywords() Group by the meta_keywords column
*
* @method ChildSelectionContainerI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSelectionContainerI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSelectionContainerI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSelectionContainerI18nQuery leftJoinSelectionContainer($relationAlias = null) Adds a LEFT JOIN clause to the query using the SelectionContainer relation
* @method ChildSelectionContainerI18nQuery rightJoinSelectionContainer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SelectionContainer relation
* @method ChildSelectionContainerI18nQuery innerJoinSelectionContainer($relationAlias = null) Adds a INNER JOIN clause to the query using the SelectionContainer relation
*
* @method ChildSelectionContainerI18n findOne(ConnectionInterface $con = null) Return the first ChildSelectionContainerI18n matching the query
* @method ChildSelectionContainerI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSelectionContainerI18n matching the query, or a new ChildSelectionContainerI18n object populated from the query conditions when no match is found
*
* @method ChildSelectionContainerI18n findOneById(int $id) Return the first ChildSelectionContainerI18n filtered by the id column
* @method ChildSelectionContainerI18n findOneByLocale(string $locale) Return the first ChildSelectionContainerI18n filtered by the locale column
* @method ChildSelectionContainerI18n findOneByTitle(string $title) Return the first ChildSelectionContainerI18n filtered by the title column
* @method ChildSelectionContainerI18n findOneByDescription(string $description) Return the first ChildSelectionContainerI18n filtered by the description column
* @method ChildSelectionContainerI18n findOneByChapo(string $chapo) Return the first ChildSelectionContainerI18n filtered by the chapo column
* @method ChildSelectionContainerI18n findOneByPostscriptum(string $postscriptum) Return the first ChildSelectionContainerI18n filtered by the postscriptum column
* @method ChildSelectionContainerI18n findOneByMetaTitle(string $meta_title) Return the first ChildSelectionContainerI18n filtered by the meta_title column
* @method ChildSelectionContainerI18n findOneByMetaDescription(string $meta_description) Return the first ChildSelectionContainerI18n filtered by the meta_description column
* @method ChildSelectionContainerI18n findOneByMetaKeywords(string $meta_keywords) Return the first ChildSelectionContainerI18n filtered by the meta_keywords column
*
* @method array findById(int $id) Return ChildSelectionContainerI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildSelectionContainerI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildSelectionContainerI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildSelectionContainerI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildSelectionContainerI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildSelectionContainerI18n objects filtered by the postscriptum column
* @method array findByMetaTitle(string $meta_title) Return ChildSelectionContainerI18n objects filtered by the meta_title column
* @method array findByMetaDescription(string $meta_description) Return ChildSelectionContainerI18n objects filtered by the meta_description column
* @method array findByMetaKeywords(string $meta_keywords) Return ChildSelectionContainerI18n objects filtered by the meta_keywords column
*
*/
abstract class SelectionContainerI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Selection\Model\Base\SelectionContainerI18nQuery 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 = '\\Selection\\Model\\SelectionContainerI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSelectionContainerI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSelectionContainerI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Selection\Model\SelectionContainerI18nQuery) {
return $criteria;
}
$query = new \Selection\Model\SelectionContainerI18nQuery();
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 ChildSelectionContainerI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SelectionContainerI18nTableMap::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(SelectionContainerI18nTableMap::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 ChildSelectionContainerI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORDS FROM selection_container_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 ChildSelectionContainerI18n();
$obj->hydrate($row);
SelectionContainerI18nTableMap::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 ChildSelectionContainerI18n|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 ChildSelectionContainerI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(SelectionContainerI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(SelectionContainerI18nTableMap::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 ChildSelectionContainerI18nQuery 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(SelectionContainerI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(SelectionContainerI18nTableMap::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 filterBySelectionContainer()
*
* @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 ChildSelectionContainerI18nQuery 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(SelectionContainerI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SelectionContainerI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerI18nTableMap::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 ChildSelectionContainerI18nQuery 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(SelectionContainerI18nTableMap::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 ChildSelectionContainerI18nQuery 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(SelectionContainerI18nTableMap::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 ChildSelectionContainerI18nQuery 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(SelectionContainerI18nTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerI18nQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionContainerI18nTableMap::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $postscriptum The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerI18nQuery The current query, for fluid interface
*/
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionContainerI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query on the meta_title column
*
* Example usage:
* <code>
* $query->filterByMetaTitle('fooValue'); // WHERE meta_title = 'fooValue'
* $query->filterByMetaTitle('%fooValue%'); // WHERE meta_title LIKE '%fooValue%'
* </code>
*
* @param string $metaTitle 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 ChildSelectionContainerI18nQuery The current query, for fluid interface
*/
public function filterByMetaTitle($metaTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaTitle)) {
$metaTitle = str_replace('*', '%', $metaTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionContainerI18nTableMap::META_TITLE, $metaTitle, $comparison);
}
/**
* Filter the query on the meta_description column
*
* Example usage:
* <code>
* $query->filterByMetaDescription('fooValue'); // WHERE meta_description = 'fooValue'
* $query->filterByMetaDescription('%fooValue%'); // WHERE meta_description LIKE '%fooValue%'
* </code>
*
* @param string $metaDescription 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 ChildSelectionContainerI18nQuery The current query, for fluid interface
*/
public function filterByMetaDescription($metaDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaDescription)) {
$metaDescription = str_replace('*', '%', $metaDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionContainerI18nTableMap::META_DESCRIPTION, $metaDescription, $comparison);
}
/**
* Filter the query on the meta_keywords column
*
* Example usage:
* <code>
* $query->filterByMetaKeywords('fooValue'); // WHERE meta_keywords = 'fooValue'
* $query->filterByMetaKeywords('%fooValue%'); // WHERE meta_keywords LIKE '%fooValue%'
* </code>
*
* @param string $metaKeywords 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 ChildSelectionContainerI18nQuery The current query, for fluid interface
*/
public function filterByMetaKeywords($metaKeywords = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaKeywords)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaKeywords)) {
$metaKeywords = str_replace('*', '%', $metaKeywords);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionContainerI18nTableMap::META_KEYWORDS, $metaKeywords, $comparison);
}
/**
* Filter the query by a related \Selection\Model\SelectionContainer object
*
* @param \Selection\Model\SelectionContainer|ObjectCollection $selectionContainer The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerI18nQuery The current query, for fluid interface
*/
public function filterBySelectionContainer($selectionContainer, $comparison = null)
{
if ($selectionContainer instanceof \Selection\Model\SelectionContainer) {
return $this
->addUsingAlias(SelectionContainerI18nTableMap::ID, $selectionContainer->getId(), $comparison);
} elseif ($selectionContainer instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionContainerI18nTableMap::ID, $selectionContainer->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySelectionContainer() only accepts arguments of type \Selection\Model\SelectionContainer or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SelectionContainer relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContainerI18nQuery The current query, for fluid interface
*/
public function joinSelectionContainer($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SelectionContainer');
// 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, 'SelectionContainer');
}
return $this;
}
/**
* Use the SelectionContainer relation SelectionContainer 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 \Selection\Model\SelectionContainerQuery A secondary query class using the current class as primary query
*/
public function useSelectionContainerQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinSelectionContainer($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SelectionContainer', '\Selection\Model\SelectionContainerQuery');
}
/**
* Exclude object from result
*
* @param ChildSelectionContainerI18n $selectionContainerI18n Object to remove from the list of results
*
* @return ChildSelectionContainerI18nQuery The current query, for fluid interface
*/
public function prune($selectionContainerI18n = null)
{
if ($selectionContainerI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(SelectionContainerI18nTableMap::ID), $selectionContainerI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(SelectionContainerI18nTableMap::LOCALE), $selectionContainerI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the selection_container_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(SelectionContainerI18nTableMap::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).
SelectionContainerI18nTableMap::clearInstancePool();
SelectionContainerI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSelectionContainerI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSelectionContainerI18n 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(SelectionContainerI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SelectionContainerI18nTableMap::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();
SelectionContainerI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SelectionContainerI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // SelectionContainerI18nQuery

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,607 @@
<?php
namespace Selection\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 Selection\Model\SelectionContainerImageI18n as ChildSelectionContainerImageI18n;
use Selection\Model\SelectionContainerImageI18nQuery as ChildSelectionContainerImageI18nQuery;
use Selection\Model\Map\SelectionContainerImageI18nTableMap;
/**
* Base class that represents a query for the 'selection_container_image_i18n' table.
*
*
*
* @method ChildSelectionContainerImageI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSelectionContainerImageI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildSelectionContainerImageI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildSelectionContainerImageI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildSelectionContainerImageI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildSelectionContainerImageI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
*
* @method ChildSelectionContainerImageI18nQuery groupById() Group by the id column
* @method ChildSelectionContainerImageI18nQuery groupByLocale() Group by the locale column
* @method ChildSelectionContainerImageI18nQuery groupByTitle() Group by the title column
* @method ChildSelectionContainerImageI18nQuery groupByDescription() Group by the description column
* @method ChildSelectionContainerImageI18nQuery groupByChapo() Group by the chapo column
* @method ChildSelectionContainerImageI18nQuery groupByPostscriptum() Group by the postscriptum column
*
* @method ChildSelectionContainerImageI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSelectionContainerImageI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSelectionContainerImageI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSelectionContainerImageI18nQuery leftJoinSelectionContainerImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the SelectionContainerImage relation
* @method ChildSelectionContainerImageI18nQuery rightJoinSelectionContainerImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SelectionContainerImage relation
* @method ChildSelectionContainerImageI18nQuery innerJoinSelectionContainerImage($relationAlias = null) Adds a INNER JOIN clause to the query using the SelectionContainerImage relation
*
* @method ChildSelectionContainerImageI18n findOne(ConnectionInterface $con = null) Return the first ChildSelectionContainerImageI18n matching the query
* @method ChildSelectionContainerImageI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSelectionContainerImageI18n matching the query, or a new ChildSelectionContainerImageI18n object populated from the query conditions when no match is found
*
* @method ChildSelectionContainerImageI18n findOneById(int $id) Return the first ChildSelectionContainerImageI18n filtered by the id column
* @method ChildSelectionContainerImageI18n findOneByLocale(string $locale) Return the first ChildSelectionContainerImageI18n filtered by the locale column
* @method ChildSelectionContainerImageI18n findOneByTitle(string $title) Return the first ChildSelectionContainerImageI18n filtered by the title column
* @method ChildSelectionContainerImageI18n findOneByDescription(string $description) Return the first ChildSelectionContainerImageI18n filtered by the description column
* @method ChildSelectionContainerImageI18n findOneByChapo(string $chapo) Return the first ChildSelectionContainerImageI18n filtered by the chapo column
* @method ChildSelectionContainerImageI18n findOneByPostscriptum(string $postscriptum) Return the first ChildSelectionContainerImageI18n filtered by the postscriptum column
*
* @method array findById(int $id) Return ChildSelectionContainerImageI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildSelectionContainerImageI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildSelectionContainerImageI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildSelectionContainerImageI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildSelectionContainerImageI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildSelectionContainerImageI18n objects filtered by the postscriptum column
*
*/
abstract class SelectionContainerImageI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Selection\Model\Base\SelectionContainerImageI18nQuery 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 = '\\Selection\\Model\\SelectionContainerImageI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSelectionContainerImageI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSelectionContainerImageI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Selection\Model\SelectionContainerImageI18nQuery) {
return $criteria;
}
$query = new \Selection\Model\SelectionContainerImageI18nQuery();
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 ChildSelectionContainerImageI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SelectionContainerImageI18nTableMap::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(SelectionContainerImageI18nTableMap::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 ChildSelectionContainerImageI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM selection_container_image_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 ChildSelectionContainerImageI18n();
$obj->hydrate($row);
SelectionContainerImageI18nTableMap::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 ChildSelectionContainerImageI18n|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 ChildSelectionContainerImageI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(SelectionContainerImageI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(SelectionContainerImageI18nTableMap::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 ChildSelectionContainerImageI18nQuery 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(SelectionContainerImageI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(SelectionContainerImageI18nTableMap::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 filterBySelectionContainerImage()
*
* @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 ChildSelectionContainerImageI18nQuery 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(SelectionContainerImageI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SelectionContainerImageI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerImageI18nTableMap::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 ChildSelectionContainerImageI18nQuery 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(SelectionContainerImageI18nTableMap::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 ChildSelectionContainerImageI18nQuery 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(SelectionContainerImageI18nTableMap::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 ChildSelectionContainerImageI18nQuery 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(SelectionContainerImageI18nTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerImageI18nQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionContainerImageI18nTableMap::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $postscriptum The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerImageI18nQuery The current query, for fluid interface
*/
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionContainerImageI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query by a related \Selection\Model\SelectionContainerImage object
*
* @param \Selection\Model\SelectionContainerImage|ObjectCollection $selectionContainerImage The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerImageI18nQuery The current query, for fluid interface
*/
public function filterBySelectionContainerImage($selectionContainerImage, $comparison = null)
{
if ($selectionContainerImage instanceof \Selection\Model\SelectionContainerImage) {
return $this
->addUsingAlias(SelectionContainerImageI18nTableMap::ID, $selectionContainerImage->getId(), $comparison);
} elseif ($selectionContainerImage instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionContainerImageI18nTableMap::ID, $selectionContainerImage->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySelectionContainerImage() only accepts arguments of type \Selection\Model\SelectionContainerImage or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SelectionContainerImage relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContainerImageI18nQuery The current query, for fluid interface
*/
public function joinSelectionContainerImage($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SelectionContainerImage');
// 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, 'SelectionContainerImage');
}
return $this;
}
/**
* Use the SelectionContainerImage relation SelectionContainerImage 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 \Selection\Model\SelectionContainerImageQuery A secondary query class using the current class as primary query
*/
public function useSelectionContainerImageQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinSelectionContainerImage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SelectionContainerImage', '\Selection\Model\SelectionContainerImageQuery');
}
/**
* Exclude object from result
*
* @param ChildSelectionContainerImageI18n $selectionContainerImageI18n Object to remove from the list of results
*
* @return ChildSelectionContainerImageI18nQuery The current query, for fluid interface
*/
public function prune($selectionContainerImageI18n = null)
{
if ($selectionContainerImageI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(SelectionContainerImageI18nTableMap::ID), $selectionContainerImageI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(SelectionContainerImageI18nTableMap::LOCALE), $selectionContainerImageI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the selection_container_image_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(SelectionContainerImageI18nTableMap::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).
SelectionContainerImageI18nTableMap::clearInstancePool();
SelectionContainerImageI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSelectionContainerImageI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSelectionContainerImageI18n 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(SelectionContainerImageI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SelectionContainerImageI18nTableMap::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();
SelectionContainerImageI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SelectionContainerImageI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // SelectionContainerImageI18nQuery

View File

@@ -0,0 +1,891 @@
<?php
namespace Selection\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 Selection\Model\SelectionContainerImage as ChildSelectionContainerImage;
use Selection\Model\SelectionContainerImageI18nQuery as ChildSelectionContainerImageI18nQuery;
use Selection\Model\SelectionContainerImageQuery as ChildSelectionContainerImageQuery;
use Selection\Model\Map\SelectionContainerImageTableMap;
/**
* Base class that represents a query for the 'selection_container_image' table.
*
*
*
* @method ChildSelectionContainerImageQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSelectionContainerImageQuery orderBySelectionContainerId($order = Criteria::ASC) Order by the selection_container_id column
* @method ChildSelectionContainerImageQuery orderByFile($order = Criteria::ASC) Order by the file column
* @method ChildSelectionContainerImageQuery orderByVisible($order = Criteria::ASC) Order by the visible column
* @method ChildSelectionContainerImageQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildSelectionContainerImageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildSelectionContainerImageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildSelectionContainerImageQuery groupById() Group by the id column
* @method ChildSelectionContainerImageQuery groupBySelectionContainerId() Group by the selection_container_id column
* @method ChildSelectionContainerImageQuery groupByFile() Group by the file column
* @method ChildSelectionContainerImageQuery groupByVisible() Group by the visible column
* @method ChildSelectionContainerImageQuery groupByPosition() Group by the position column
* @method ChildSelectionContainerImageQuery groupByCreatedAt() Group by the created_at column
* @method ChildSelectionContainerImageQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildSelectionContainerImageQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSelectionContainerImageQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSelectionContainerImageQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSelectionContainerImageQuery leftJoinSelectionContainer($relationAlias = null) Adds a LEFT JOIN clause to the query using the SelectionContainer relation
* @method ChildSelectionContainerImageQuery rightJoinSelectionContainer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SelectionContainer relation
* @method ChildSelectionContainerImageQuery innerJoinSelectionContainer($relationAlias = null) Adds a INNER JOIN clause to the query using the SelectionContainer relation
*
* @method ChildSelectionContainerImageQuery leftJoinSelectionContainerImageI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the SelectionContainerImageI18n relation
* @method ChildSelectionContainerImageQuery rightJoinSelectionContainerImageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SelectionContainerImageI18n relation
* @method ChildSelectionContainerImageQuery innerJoinSelectionContainerImageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the SelectionContainerImageI18n relation
*
* @method ChildSelectionContainerImage findOne(ConnectionInterface $con = null) Return the first ChildSelectionContainerImage matching the query
* @method ChildSelectionContainerImage findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSelectionContainerImage matching the query, or a new ChildSelectionContainerImage object populated from the query conditions when no match is found
*
* @method ChildSelectionContainerImage findOneById(int $id) Return the first ChildSelectionContainerImage filtered by the id column
* @method ChildSelectionContainerImage findOneBySelectionContainerId(int $selection_container_id) Return the first ChildSelectionContainerImage filtered by the selection_container_id column
* @method ChildSelectionContainerImage findOneByFile(string $file) Return the first ChildSelectionContainerImage filtered by the file column
* @method ChildSelectionContainerImage findOneByVisible(int $visible) Return the first ChildSelectionContainerImage filtered by the visible column
* @method ChildSelectionContainerImage findOneByPosition(int $position) Return the first ChildSelectionContainerImage filtered by the position column
* @method ChildSelectionContainerImage findOneByCreatedAt(string $created_at) Return the first ChildSelectionContainerImage filtered by the created_at column
* @method ChildSelectionContainerImage findOneByUpdatedAt(string $updated_at) Return the first ChildSelectionContainerImage filtered by the updated_at column
*
* @method array findById(int $id) Return ChildSelectionContainerImage objects filtered by the id column
* @method array findBySelectionContainerId(int $selection_container_id) Return ChildSelectionContainerImage objects filtered by the selection_container_id column
* @method array findByFile(string $file) Return ChildSelectionContainerImage objects filtered by the file column
* @method array findByVisible(int $visible) Return ChildSelectionContainerImage objects filtered by the visible column
* @method array findByPosition(int $position) Return ChildSelectionContainerImage objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildSelectionContainerImage objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildSelectionContainerImage objects filtered by the updated_at column
*
*/
abstract class SelectionContainerImageQuery extends ModelCriteria
{
/**
* Initializes internal state of \Selection\Model\Base\SelectionContainerImageQuery 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 = '\\Selection\\Model\\SelectionContainerImage', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSelectionContainerImageQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSelectionContainerImageQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Selection\Model\SelectionContainerImageQuery) {
return $criteria;
}
$query = new \Selection\Model\SelectionContainerImageQuery();
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 ChildSelectionContainerImage|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SelectionContainerImageTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(SelectionContainerImageTableMap::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 ChildSelectionContainerImage A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, SELECTION_CONTAINER_ID, FILE, VISIBLE, POSITION, CREATED_AT, UPDATED_AT FROM selection_container_image 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 ChildSelectionContainerImage();
$obj->hydrate($row);
SelectionContainerImageTableMap::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 ChildSelectionContainerImage|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 ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(SelectionContainerImageTableMap::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 ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(SelectionContainerImageTableMap::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 ChildSelectionContainerImageQuery 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(SelectionContainerImageTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SelectionContainerImageTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerImageTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the selection_container_id column
*
* Example usage:
* <code>
* $query->filterBySelectionContainerId(1234); // WHERE selection_container_id = 1234
* $query->filterBySelectionContainerId(array(12, 34)); // WHERE selection_container_id IN (12, 34)
* $query->filterBySelectionContainerId(array('min' => 12)); // WHERE selection_container_id > 12
* </code>
*
* @see filterBySelectionContainer()
*
* @param mixed $selectionContainerId 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 ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function filterBySelectionContainerId($selectionContainerId = null, $comparison = null)
{
if (is_array($selectionContainerId)) {
$useMinMax = false;
if (isset($selectionContainerId['min'])) {
$this->addUsingAlias(SelectionContainerImageTableMap::SELECTION_CONTAINER_ID, $selectionContainerId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($selectionContainerId['max'])) {
$this->addUsingAlias(SelectionContainerImageTableMap::SELECTION_CONTAINER_ID, $selectionContainerId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerImageTableMap::SELECTION_CONTAINER_ID, $selectionContainerId, $comparison);
}
/**
* Filter the query on the file column
*
* Example usage:
* <code>
* $query->filterByFile('fooValue'); // WHERE file = 'fooValue'
* $query->filterByFile('%fooValue%'); // WHERE file LIKE '%fooValue%'
* </code>
*
* @param string $file 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 ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function filterByFile($file = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($file)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $file)) {
$file = str_replace('*', '%', $file);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionContainerImageTableMap::FILE, $file, $comparison);
}
/**
* Filter the query on the visible column
*
* Example usage:
* <code>
* $query->filterByVisible(1234); // WHERE visible = 1234
* $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
* $query->filterByVisible(array('min' => 12)); // WHERE visible > 12
* </code>
*
* @param mixed $visible The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function filterByVisible($visible = null, $comparison = null)
{
if (is_array($visible)) {
$useMinMax = false;
if (isset($visible['min'])) {
$this->addUsingAlias(SelectionContainerImageTableMap::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($visible['max'])) {
$this->addUsingAlias(SelectionContainerImageTableMap::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerImageTableMap::VISIBLE, $visible, $comparison);
}
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerImageQuery 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(SelectionContainerImageTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(SelectionContainerImageTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerImageTableMap::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 ChildSelectionContainerImageQuery 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(SelectionContainerImageTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(SelectionContainerImageTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerImageTableMap::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 ChildSelectionContainerImageQuery 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(SelectionContainerImageTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(SelectionContainerImageTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerImageTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Selection\Model\SelectionContainer object
*
* @param \Selection\Model\SelectionContainer|ObjectCollection $selectionContainer The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function filterBySelectionContainer($selectionContainer, $comparison = null)
{
if ($selectionContainer instanceof \Selection\Model\SelectionContainer) {
return $this
->addUsingAlias(SelectionContainerImageTableMap::SELECTION_CONTAINER_ID, $selectionContainer->getId(), $comparison);
} elseif ($selectionContainer instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionContainerImageTableMap::SELECTION_CONTAINER_ID, $selectionContainer->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySelectionContainer() only accepts arguments of type \Selection\Model\SelectionContainer or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SelectionContainer relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function joinSelectionContainer($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SelectionContainer');
// 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, 'SelectionContainer');
}
return $this;
}
/**
* Use the SelectionContainer relation SelectionContainer 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 \Selection\Model\SelectionContainerQuery A secondary query class using the current class as primary query
*/
public function useSelectionContainerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSelectionContainer($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SelectionContainer', '\Selection\Model\SelectionContainerQuery');
}
/**
* Filter the query by a related \Selection\Model\SelectionContainerImageI18n object
*
* @param \Selection\Model\SelectionContainerImageI18n|ObjectCollection $selectionContainerImageI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function filterBySelectionContainerImageI18n($selectionContainerImageI18n, $comparison = null)
{
if ($selectionContainerImageI18n instanceof \Selection\Model\SelectionContainerImageI18n) {
return $this
->addUsingAlias(SelectionContainerImageTableMap::ID, $selectionContainerImageI18n->getId(), $comparison);
} elseif ($selectionContainerImageI18n instanceof ObjectCollection) {
return $this
->useSelectionContainerImageI18nQuery()
->filterByPrimaryKeys($selectionContainerImageI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterBySelectionContainerImageI18n() only accepts arguments of type \Selection\Model\SelectionContainerImageI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SelectionContainerImageI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function joinSelectionContainerImageI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SelectionContainerImageI18n');
// 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, 'SelectionContainerImageI18n');
}
return $this;
}
/**
* Use the SelectionContainerImageI18n relation SelectionContainerImageI18n 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 \Selection\Model\SelectionContainerImageI18nQuery A secondary query class using the current class as primary query
*/
public function useSelectionContainerImageI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinSelectionContainerImageI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SelectionContainerImageI18n', '\Selection\Model\SelectionContainerImageI18nQuery');
}
/**
* Exclude object from result
*
* @param ChildSelectionContainerImage $selectionContainerImage Object to remove from the list of results
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function prune($selectionContainerImage = null)
{
if ($selectionContainerImage) {
$this->addUsingAlias(SelectionContainerImageTableMap::ID, $selectionContainerImage->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the selection_container_image 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(SelectionContainerImageTableMap::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).
SelectionContainerImageTableMap::clearInstancePool();
SelectionContainerImageTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSelectionContainerImage or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSelectionContainerImage 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(SelectionContainerImageTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SelectionContainerImageTableMap::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();
SelectionContainerImageTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SelectionContainerImageTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(SelectionContainerImageTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(SelectionContainerImageTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionContainerImageTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionContainerImageTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionContainerImageTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionContainerImageTableMap::CREATED_AT);
}
// 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 ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'SelectionContainerImageI18n';
return $this
->joinSelectionContainerImageI18n($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 ChildSelectionContainerImageQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('SelectionContainerImageI18n');
$this->with['SelectionContainerImageI18n']->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 ChildSelectionContainerImageI18nQuery 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 : 'SelectionContainerImageI18n', '\Selection\Model\SelectionContainerImageI18nQuery');
}
} // SelectionContainerImageQuery

View File

@@ -0,0 +1,886 @@
<?php
namespace Selection\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 Selection\Model\SelectionContainer as ChildSelectionContainer;
use Selection\Model\SelectionContainerI18nQuery as ChildSelectionContainerI18nQuery;
use Selection\Model\SelectionContainerQuery as ChildSelectionContainerQuery;
use Selection\Model\Map\SelectionContainerTableMap;
/**
* Base class that represents a query for the 'selection_container' table.
*
*
*
* @method ChildSelectionContainerQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSelectionContainerQuery orderByVisible($order = Criteria::ASC) Order by the visible column
* @method ChildSelectionContainerQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildSelectionContainerQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildSelectionContainerQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildSelectionContainerQuery groupById() Group by the id column
* @method ChildSelectionContainerQuery groupByVisible() Group by the visible column
* @method ChildSelectionContainerQuery groupByPosition() Group by the position column
* @method ChildSelectionContainerQuery groupByCreatedAt() Group by the created_at column
* @method ChildSelectionContainerQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildSelectionContainerQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSelectionContainerQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSelectionContainerQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSelectionContainerQuery leftJoinSelectionContainerAssociatedSelection($relationAlias = null) Adds a LEFT JOIN clause to the query using the SelectionContainerAssociatedSelection relation
* @method ChildSelectionContainerQuery rightJoinSelectionContainerAssociatedSelection($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SelectionContainerAssociatedSelection relation
* @method ChildSelectionContainerQuery innerJoinSelectionContainerAssociatedSelection($relationAlias = null) Adds a INNER JOIN clause to the query using the SelectionContainerAssociatedSelection relation
*
* @method ChildSelectionContainerQuery leftJoinSelectionContainerImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the SelectionContainerImage relation
* @method ChildSelectionContainerQuery rightJoinSelectionContainerImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SelectionContainerImage relation
* @method ChildSelectionContainerQuery innerJoinSelectionContainerImage($relationAlias = null) Adds a INNER JOIN clause to the query using the SelectionContainerImage relation
*
* @method ChildSelectionContainerQuery leftJoinSelectionContainerI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the SelectionContainerI18n relation
* @method ChildSelectionContainerQuery rightJoinSelectionContainerI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SelectionContainerI18n relation
* @method ChildSelectionContainerQuery innerJoinSelectionContainerI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the SelectionContainerI18n relation
*
* @method ChildSelectionContainer findOne(ConnectionInterface $con = null) Return the first ChildSelectionContainer matching the query
* @method ChildSelectionContainer findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSelectionContainer matching the query, or a new ChildSelectionContainer object populated from the query conditions when no match is found
*
* @method ChildSelectionContainer findOneById(int $id) Return the first ChildSelectionContainer filtered by the id column
* @method ChildSelectionContainer findOneByVisible(int $visible) Return the first ChildSelectionContainer filtered by the visible column
* @method ChildSelectionContainer findOneByPosition(int $position) Return the first ChildSelectionContainer filtered by the position column
* @method ChildSelectionContainer findOneByCreatedAt(string $created_at) Return the first ChildSelectionContainer filtered by the created_at column
* @method ChildSelectionContainer findOneByUpdatedAt(string $updated_at) Return the first ChildSelectionContainer filtered by the updated_at column
*
* @method array findById(int $id) Return ChildSelectionContainer objects filtered by the id column
* @method array findByVisible(int $visible) Return ChildSelectionContainer objects filtered by the visible column
* @method array findByPosition(int $position) Return ChildSelectionContainer objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildSelectionContainer objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildSelectionContainer objects filtered by the updated_at column
*
*/
abstract class SelectionContainerQuery extends ModelCriteria
{
/**
* Initializes internal state of \Selection\Model\Base\SelectionContainerQuery 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 = '\\Selection\\Model\\SelectionContainer', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSelectionContainerQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSelectionContainerQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Selection\Model\SelectionContainerQuery) {
return $criteria;
}
$query = new \Selection\Model\SelectionContainerQuery();
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 ChildSelectionContainer|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SelectionContainerTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(SelectionContainerTableMap::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 ChildSelectionContainer A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, VISIBLE, POSITION, CREATED_AT, UPDATED_AT FROM selection_container 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 ChildSelectionContainer();
$obj->hydrate($row);
SelectionContainerTableMap::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 ChildSelectionContainer|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 ChildSelectionContainerQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(SelectionContainerTableMap::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 ChildSelectionContainerQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(SelectionContainerTableMap::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 ChildSelectionContainerQuery 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(SelectionContainerTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SelectionContainerTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the visible column
*
* Example usage:
* <code>
* $query->filterByVisible(1234); // WHERE visible = 1234
* $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
* $query->filterByVisible(array('min' => 12)); // WHERE visible > 12
* </code>
*
* @param mixed $visible The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function filterByVisible($visible = null, $comparison = null)
{
if (is_array($visible)) {
$useMinMax = false;
if (isset($visible['min'])) {
$this->addUsingAlias(SelectionContainerTableMap::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($visible['max'])) {
$this->addUsingAlias(SelectionContainerTableMap::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerTableMap::VISIBLE, $visible, $comparison);
}
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerQuery 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(SelectionContainerTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(SelectionContainerTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerTableMap::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 ChildSelectionContainerQuery 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(SelectionContainerTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(SelectionContainerTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerTableMap::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 ChildSelectionContainerQuery 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(SelectionContainerTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(SelectionContainerTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContainerTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Selection\Model\SelectionContainerAssociatedSelection object
*
* @param \Selection\Model\SelectionContainerAssociatedSelection|ObjectCollection $selectionContainerAssociatedSelection the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function filterBySelectionContainerAssociatedSelection($selectionContainerAssociatedSelection, $comparison = null)
{
if ($selectionContainerAssociatedSelection instanceof \Selection\Model\SelectionContainerAssociatedSelection) {
return $this
->addUsingAlias(SelectionContainerTableMap::ID, $selectionContainerAssociatedSelection->getSelectionContainerId(), $comparison);
} elseif ($selectionContainerAssociatedSelection instanceof ObjectCollection) {
return $this
->useSelectionContainerAssociatedSelectionQuery()
->filterByPrimaryKeys($selectionContainerAssociatedSelection->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterBySelectionContainerAssociatedSelection() only accepts arguments of type \Selection\Model\SelectionContainerAssociatedSelection or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SelectionContainerAssociatedSelection relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function joinSelectionContainerAssociatedSelection($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SelectionContainerAssociatedSelection');
// 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, 'SelectionContainerAssociatedSelection');
}
return $this;
}
/**
* Use the SelectionContainerAssociatedSelection relation SelectionContainerAssociatedSelection 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 \Selection\Model\SelectionContainerAssociatedSelectionQuery A secondary query class using the current class as primary query
*/
public function useSelectionContainerAssociatedSelectionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSelectionContainerAssociatedSelection($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SelectionContainerAssociatedSelection', '\Selection\Model\SelectionContainerAssociatedSelectionQuery');
}
/**
* Filter the query by a related \Selection\Model\SelectionContainerImage object
*
* @param \Selection\Model\SelectionContainerImage|ObjectCollection $selectionContainerImage the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function filterBySelectionContainerImage($selectionContainerImage, $comparison = null)
{
if ($selectionContainerImage instanceof \Selection\Model\SelectionContainerImage) {
return $this
->addUsingAlias(SelectionContainerTableMap::ID, $selectionContainerImage->getSelectionContainerId(), $comparison);
} elseif ($selectionContainerImage instanceof ObjectCollection) {
return $this
->useSelectionContainerImageQuery()
->filterByPrimaryKeys($selectionContainerImage->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterBySelectionContainerImage() only accepts arguments of type \Selection\Model\SelectionContainerImage or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SelectionContainerImage relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function joinSelectionContainerImage($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SelectionContainerImage');
// 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, 'SelectionContainerImage');
}
return $this;
}
/**
* Use the SelectionContainerImage relation SelectionContainerImage 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 \Selection\Model\SelectionContainerImageQuery A secondary query class using the current class as primary query
*/
public function useSelectionContainerImageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSelectionContainerImage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SelectionContainerImage', '\Selection\Model\SelectionContainerImageQuery');
}
/**
* Filter the query by a related \Selection\Model\SelectionContainerI18n object
*
* @param \Selection\Model\SelectionContainerI18n|ObjectCollection $selectionContainerI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function filterBySelectionContainerI18n($selectionContainerI18n, $comparison = null)
{
if ($selectionContainerI18n instanceof \Selection\Model\SelectionContainerI18n) {
return $this
->addUsingAlias(SelectionContainerTableMap::ID, $selectionContainerI18n->getId(), $comparison);
} elseif ($selectionContainerI18n instanceof ObjectCollection) {
return $this
->useSelectionContainerI18nQuery()
->filterByPrimaryKeys($selectionContainerI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterBySelectionContainerI18n() only accepts arguments of type \Selection\Model\SelectionContainerI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SelectionContainerI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function joinSelectionContainerI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SelectionContainerI18n');
// 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, 'SelectionContainerI18n');
}
return $this;
}
/**
* Use the SelectionContainerI18n relation SelectionContainerI18n 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 \Selection\Model\SelectionContainerI18nQuery A secondary query class using the current class as primary query
*/
public function useSelectionContainerI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinSelectionContainerI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SelectionContainerI18n', '\Selection\Model\SelectionContainerI18nQuery');
}
/**
* Exclude object from result
*
* @param ChildSelectionContainer $selectionContainer Object to remove from the list of results
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function prune($selectionContainer = null)
{
if ($selectionContainer) {
$this->addUsingAlias(SelectionContainerTableMap::ID, $selectionContainer->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the selection_container 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(SelectionContainerTableMap::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).
SelectionContainerTableMap::clearInstancePool();
SelectionContainerTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSelectionContainer or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSelectionContainer 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(SelectionContainerTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SelectionContainerTableMap::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();
SelectionContainerTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SelectionContainerTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(SelectionContainerTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(SelectionContainerTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionContainerTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionContainerTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionContainerTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildSelectionContainerQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionContainerTableMap::CREATED_AT);
}
// 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 ChildSelectionContainerQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'SelectionContainerI18n';
return $this
->joinSelectionContainerI18n($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 ChildSelectionContainerQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('SelectionContainerI18n');
$this->with['SelectionContainerI18n']->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 ChildSelectionContainerI18nQuery 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 : 'SelectionContainerI18n', '\Selection\Model\SelectionContainerI18nQuery');
}
} // SelectionContainerQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,774 @@
<?php
namespace Selection\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 Selection\Model\SelectionContent as ChildSelectionContent;
use Selection\Model\SelectionContentQuery as ChildSelectionContentQuery;
use Selection\Model\Map\SelectionContentTableMap;
use Thelia\Model\Content;
/**
* Base class that represents a query for the 'selection_content' table.
*
*
*
* @method ChildSelectionContentQuery orderBySelectionId($order = Criteria::ASC) Order by the selection_id column
* @method ChildSelectionContentQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
* @method ChildSelectionContentQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildSelectionContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildSelectionContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildSelectionContentQuery groupBySelectionId() Group by the selection_id column
* @method ChildSelectionContentQuery groupByContentId() Group by the content_id column
* @method ChildSelectionContentQuery groupByPosition() Group by the position column
* @method ChildSelectionContentQuery groupByCreatedAt() Group by the created_at column
* @method ChildSelectionContentQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildSelectionContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSelectionContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSelectionContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSelectionContentQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
* @method ChildSelectionContentQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
* @method ChildSelectionContentQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
*
* @method ChildSelectionContentQuery leftJoinSelection($relationAlias = null) Adds a LEFT JOIN clause to the query using the Selection relation
* @method ChildSelectionContentQuery rightJoinSelection($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Selection relation
* @method ChildSelectionContentQuery innerJoinSelection($relationAlias = null) Adds a INNER JOIN clause to the query using the Selection relation
*
* @method ChildSelectionContent findOne(ConnectionInterface $con = null) Return the first ChildSelectionContent matching the query
* @method ChildSelectionContent findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSelectionContent matching the query, or a new ChildSelectionContent object populated from the query conditions when no match is found
*
* @method ChildSelectionContent findOneBySelectionId(int $selection_id) Return the first ChildSelectionContent filtered by the selection_id column
* @method ChildSelectionContent findOneByContentId(int $content_id) Return the first ChildSelectionContent filtered by the content_id column
* @method ChildSelectionContent findOneByPosition(int $position) Return the first ChildSelectionContent filtered by the position column
* @method ChildSelectionContent findOneByCreatedAt(string $created_at) Return the first ChildSelectionContent filtered by the created_at column
* @method ChildSelectionContent findOneByUpdatedAt(string $updated_at) Return the first ChildSelectionContent filtered by the updated_at column
*
* @method array findBySelectionId(int $selection_id) Return ChildSelectionContent objects filtered by the selection_id column
* @method array findByContentId(int $content_id) Return ChildSelectionContent objects filtered by the content_id column
* @method array findByPosition(int $position) Return ChildSelectionContent objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildSelectionContent objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildSelectionContent objects filtered by the updated_at column
*
*/
abstract class SelectionContentQuery extends ModelCriteria
{
/**
* Initializes internal state of \Selection\Model\Base\SelectionContentQuery 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 = '\\Selection\\Model\\SelectionContent', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSelectionContentQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSelectionContentQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Selection\Model\SelectionContentQuery) {
return $criteria;
}
$query = new \Selection\Model\SelectionContentQuery();
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[$selection_id, $content_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildSelectionContent|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SelectionContentTableMap::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(SelectionContentTableMap::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 ChildSelectionContent A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT SELECTION_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM selection_content WHERE SELECTION_ID = :p0 AND CONTENT_ID = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildSelectionContent();
$obj->hydrate($row);
SelectionContentTableMap::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 ChildSelectionContent|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 ChildSelectionContentQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(SelectionContentTableMap::SELECTION_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(SelectionContentTableMap::CONTENT_ID, $key[1], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildSelectionContentQuery 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(SelectionContentTableMap::SELECTION_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(SelectionContentTableMap::CONTENT_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the selection_id column
*
* Example usage:
* <code>
* $query->filterBySelectionId(1234); // WHERE selection_id = 1234
* $query->filterBySelectionId(array(12, 34)); // WHERE selection_id IN (12, 34)
* $query->filterBySelectionId(array('min' => 12)); // WHERE selection_id > 12
* </code>
*
* @see filterBySelection()
*
* @param mixed $selectionId 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 ChildSelectionContentQuery The current query, for fluid interface
*/
public function filterBySelectionId($selectionId = null, $comparison = null)
{
if (is_array($selectionId)) {
$useMinMax = false;
if (isset($selectionId['min'])) {
$this->addUsingAlias(SelectionContentTableMap::SELECTION_ID, $selectionId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($selectionId['max'])) {
$this->addUsingAlias(SelectionContentTableMap::SELECTION_ID, $selectionId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContentTableMap::SELECTION_ID, $selectionId, $comparison);
}
/**
* Filter the query on the content_id column
*
* Example usage:
* <code>
* $query->filterByContentId(1234); // WHERE content_id = 1234
* $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34)
* $query->filterByContentId(array('min' => 12)); // WHERE content_id > 12
* </code>
*
* @see filterByContent()
*
* @param mixed $contentId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function filterByContentId($contentId = null, $comparison = null)
{
if (is_array($contentId)) {
$useMinMax = false;
if (isset($contentId['min'])) {
$this->addUsingAlias(SelectionContentTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($contentId['max'])) {
$this->addUsingAlias(SelectionContentTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContentTableMap::CONTENT_ID, $contentId, $comparison);
}
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContentQuery 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(SelectionContentTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(SelectionContentTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContentTableMap::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 ChildSelectionContentQuery 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(SelectionContentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(SelectionContentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContentTableMap::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 ChildSelectionContentQuery 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(SelectionContentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(SelectionContentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionContentTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Content object
*
* @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function filterByContent($content, $comparison = null)
{
if ($content instanceof \Thelia\Model\Content) {
return $this
->addUsingAlias(SelectionContentTableMap::CONTENT_ID, $content->getId(), $comparison);
} elseif ($content instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionContentTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByContent() only accepts arguments of type \Thelia\Model\Content or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Content relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function joinContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Content');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Content');
}
return $this;
}
/**
* Use the Content relation Content object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query
*/
public function useContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinContent($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery');
}
/**
* Filter the query by a related \Selection\Model\Selection object
*
* @param \Selection\Model\Selection|ObjectCollection $selection The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function filterBySelection($selection, $comparison = null)
{
if ($selection instanceof \Selection\Model\Selection) {
return $this
->addUsingAlias(SelectionContentTableMap::SELECTION_ID, $selection->getId(), $comparison);
} elseif ($selection instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionContentTableMap::SELECTION_ID, $selection->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySelection() only accepts arguments of type \Selection\Model\Selection or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Selection relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function joinSelection($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Selection');
// 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, 'Selection');
}
return $this;
}
/**
* Use the Selection relation Selection 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 \Selection\Model\SelectionQuery A secondary query class using the current class as primary query
*/
public function useSelectionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSelection($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Selection', '\Selection\Model\SelectionQuery');
}
/**
* Exclude object from result
*
* @param ChildSelectionContent $selectionContent Object to remove from the list of results
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function prune($selectionContent = null)
{
if ($selectionContent) {
$this->addCond('pruneCond0', $this->getAliasedColName(SelectionContentTableMap::SELECTION_ID), $selectionContent->getSelectionId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(SelectionContentTableMap::CONTENT_ID), $selectionContent->getContentId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the selection_content table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(SelectionContentTableMap::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).
SelectionContentTableMap::clearInstancePool();
SelectionContentTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSelectionContent or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSelectionContent 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(SelectionContentTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SelectionContentTableMap::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();
SelectionContentTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SelectionContentTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(SelectionContentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(SelectionContentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionContentTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionContentTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionContentTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildSelectionContentQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionContentTableMap::CREATED_AT);
}
} // SelectionContentQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,706 @@
<?php
namespace Selection\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 Selection\Model\SelectionI18n as ChildSelectionI18n;
use Selection\Model\SelectionI18nQuery as ChildSelectionI18nQuery;
use Selection\Model\Map\SelectionI18nTableMap;
/**
* Base class that represents a query for the 'selection_i18n' table.
*
*
*
* @method ChildSelectionI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSelectionI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildSelectionI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildSelectionI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildSelectionI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildSelectionI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ChildSelectionI18nQuery orderByMetaTitle($order = Criteria::ASC) Order by the meta_title column
* @method ChildSelectionI18nQuery orderByMetaDescription($order = Criteria::ASC) Order by the meta_description column
* @method ChildSelectionI18nQuery orderByMetaKeywords($order = Criteria::ASC) Order by the meta_keywords column
*
* @method ChildSelectionI18nQuery groupById() Group by the id column
* @method ChildSelectionI18nQuery groupByLocale() Group by the locale column
* @method ChildSelectionI18nQuery groupByTitle() Group by the title column
* @method ChildSelectionI18nQuery groupByDescription() Group by the description column
* @method ChildSelectionI18nQuery groupByChapo() Group by the chapo column
* @method ChildSelectionI18nQuery groupByPostscriptum() Group by the postscriptum column
* @method ChildSelectionI18nQuery groupByMetaTitle() Group by the meta_title column
* @method ChildSelectionI18nQuery groupByMetaDescription() Group by the meta_description column
* @method ChildSelectionI18nQuery groupByMetaKeywords() Group by the meta_keywords column
*
* @method ChildSelectionI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSelectionI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSelectionI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSelectionI18nQuery leftJoinSelection($relationAlias = null) Adds a LEFT JOIN clause to the query using the Selection relation
* @method ChildSelectionI18nQuery rightJoinSelection($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Selection relation
* @method ChildSelectionI18nQuery innerJoinSelection($relationAlias = null) Adds a INNER JOIN clause to the query using the Selection relation
*
* @method ChildSelectionI18n findOne(ConnectionInterface $con = null) Return the first ChildSelectionI18n matching the query
* @method ChildSelectionI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSelectionI18n matching the query, or a new ChildSelectionI18n object populated from the query conditions when no match is found
*
* @method ChildSelectionI18n findOneById(int $id) Return the first ChildSelectionI18n filtered by the id column
* @method ChildSelectionI18n findOneByLocale(string $locale) Return the first ChildSelectionI18n filtered by the locale column
* @method ChildSelectionI18n findOneByTitle(string $title) Return the first ChildSelectionI18n filtered by the title column
* @method ChildSelectionI18n findOneByDescription(string $description) Return the first ChildSelectionI18n filtered by the description column
* @method ChildSelectionI18n findOneByChapo(string $chapo) Return the first ChildSelectionI18n filtered by the chapo column
* @method ChildSelectionI18n findOneByPostscriptum(string $postscriptum) Return the first ChildSelectionI18n filtered by the postscriptum column
* @method ChildSelectionI18n findOneByMetaTitle(string $meta_title) Return the first ChildSelectionI18n filtered by the meta_title column
* @method ChildSelectionI18n findOneByMetaDescription(string $meta_description) Return the first ChildSelectionI18n filtered by the meta_description column
* @method ChildSelectionI18n findOneByMetaKeywords(string $meta_keywords) Return the first ChildSelectionI18n filtered by the meta_keywords column
*
* @method array findById(int $id) Return ChildSelectionI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildSelectionI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildSelectionI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildSelectionI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildSelectionI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildSelectionI18n objects filtered by the postscriptum column
* @method array findByMetaTitle(string $meta_title) Return ChildSelectionI18n objects filtered by the meta_title column
* @method array findByMetaDescription(string $meta_description) Return ChildSelectionI18n objects filtered by the meta_description column
* @method array findByMetaKeywords(string $meta_keywords) Return ChildSelectionI18n objects filtered by the meta_keywords column
*
*/
abstract class SelectionI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Selection\Model\Base\SelectionI18nQuery 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 = '\\Selection\\Model\\SelectionI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSelectionI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSelectionI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Selection\Model\SelectionI18nQuery) {
return $criteria;
}
$query = new \Selection\Model\SelectionI18nQuery();
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 ChildSelectionI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SelectionI18nTableMap::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(SelectionI18nTableMap::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 ChildSelectionI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORDS FROM selection_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 ChildSelectionI18n();
$obj->hydrate($row);
SelectionI18nTableMap::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 ChildSelectionI18n|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 ChildSelectionI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(SelectionI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(SelectionI18nTableMap::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 ChildSelectionI18nQuery 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(SelectionI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(SelectionI18nTableMap::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 filterBySelection()
*
* @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 ChildSelectionI18nQuery 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(SelectionI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SelectionI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionI18nTableMap::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 ChildSelectionI18nQuery 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(SelectionI18nTableMap::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 ChildSelectionI18nQuery 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(SelectionI18nTableMap::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 ChildSelectionI18nQuery 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(SelectionI18nTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionI18nQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionI18nTableMap::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $postscriptum The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionI18nQuery The current query, for fluid interface
*/
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query on the meta_title column
*
* Example usage:
* <code>
* $query->filterByMetaTitle('fooValue'); // WHERE meta_title = 'fooValue'
* $query->filterByMetaTitle('%fooValue%'); // WHERE meta_title LIKE '%fooValue%'
* </code>
*
* @param string $metaTitle 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 ChildSelectionI18nQuery The current query, for fluid interface
*/
public function filterByMetaTitle($metaTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaTitle)) {
$metaTitle = str_replace('*', '%', $metaTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionI18nTableMap::META_TITLE, $metaTitle, $comparison);
}
/**
* Filter the query on the meta_description column
*
* Example usage:
* <code>
* $query->filterByMetaDescription('fooValue'); // WHERE meta_description = 'fooValue'
* $query->filterByMetaDescription('%fooValue%'); // WHERE meta_description LIKE '%fooValue%'
* </code>
*
* @param string $metaDescription 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 ChildSelectionI18nQuery The current query, for fluid interface
*/
public function filterByMetaDescription($metaDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaDescription)) {
$metaDescription = str_replace('*', '%', $metaDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionI18nTableMap::META_DESCRIPTION, $metaDescription, $comparison);
}
/**
* Filter the query on the meta_keywords column
*
* Example usage:
* <code>
* $query->filterByMetaKeywords('fooValue'); // WHERE meta_keywords = 'fooValue'
* $query->filterByMetaKeywords('%fooValue%'); // WHERE meta_keywords LIKE '%fooValue%'
* </code>
*
* @param string $metaKeywords 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 ChildSelectionI18nQuery The current query, for fluid interface
*/
public function filterByMetaKeywords($metaKeywords = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaKeywords)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaKeywords)) {
$metaKeywords = str_replace('*', '%', $metaKeywords);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionI18nTableMap::META_KEYWORDS, $metaKeywords, $comparison);
}
/**
* Filter the query by a related \Selection\Model\Selection object
*
* @param \Selection\Model\Selection|ObjectCollection $selection The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionI18nQuery The current query, for fluid interface
*/
public function filterBySelection($selection, $comparison = null)
{
if ($selection instanceof \Selection\Model\Selection) {
return $this
->addUsingAlias(SelectionI18nTableMap::ID, $selection->getId(), $comparison);
} elseif ($selection instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionI18nTableMap::ID, $selection->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySelection() only accepts arguments of type \Selection\Model\Selection or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Selection relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionI18nQuery The current query, for fluid interface
*/
public function joinSelection($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Selection');
// 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, 'Selection');
}
return $this;
}
/**
* Use the Selection relation Selection 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 \Selection\Model\SelectionQuery A secondary query class using the current class as primary query
*/
public function useSelectionQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinSelection($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Selection', '\Selection\Model\SelectionQuery');
}
/**
* Exclude object from result
*
* @param ChildSelectionI18n $selectionI18n Object to remove from the list of results
*
* @return ChildSelectionI18nQuery The current query, for fluid interface
*/
public function prune($selectionI18n = null)
{
if ($selectionI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(SelectionI18nTableMap::ID), $selectionI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(SelectionI18nTableMap::LOCALE), $selectionI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the selection_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(SelectionI18nTableMap::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).
SelectionI18nTableMap::clearInstancePool();
SelectionI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSelectionI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSelectionI18n 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(SelectionI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SelectionI18nTableMap::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();
SelectionI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SelectionI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // SelectionI18nQuery

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,607 @@
<?php
namespace Selection\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 Selection\Model\SelectionImageI18n as ChildSelectionImageI18n;
use Selection\Model\SelectionImageI18nQuery as ChildSelectionImageI18nQuery;
use Selection\Model\Map\SelectionImageI18nTableMap;
/**
* Base class that represents a query for the 'selection_image_i18n' table.
*
*
*
* @method ChildSelectionImageI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSelectionImageI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildSelectionImageI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildSelectionImageI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildSelectionImageI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildSelectionImageI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
*
* @method ChildSelectionImageI18nQuery groupById() Group by the id column
* @method ChildSelectionImageI18nQuery groupByLocale() Group by the locale column
* @method ChildSelectionImageI18nQuery groupByTitle() Group by the title column
* @method ChildSelectionImageI18nQuery groupByDescription() Group by the description column
* @method ChildSelectionImageI18nQuery groupByChapo() Group by the chapo column
* @method ChildSelectionImageI18nQuery groupByPostscriptum() Group by the postscriptum column
*
* @method ChildSelectionImageI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSelectionImageI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSelectionImageI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSelectionImageI18nQuery leftJoinSelectionImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the SelectionImage relation
* @method ChildSelectionImageI18nQuery rightJoinSelectionImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SelectionImage relation
* @method ChildSelectionImageI18nQuery innerJoinSelectionImage($relationAlias = null) Adds a INNER JOIN clause to the query using the SelectionImage relation
*
* @method ChildSelectionImageI18n findOne(ConnectionInterface $con = null) Return the first ChildSelectionImageI18n matching the query
* @method ChildSelectionImageI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSelectionImageI18n matching the query, or a new ChildSelectionImageI18n object populated from the query conditions when no match is found
*
* @method ChildSelectionImageI18n findOneById(int $id) Return the first ChildSelectionImageI18n filtered by the id column
* @method ChildSelectionImageI18n findOneByLocale(string $locale) Return the first ChildSelectionImageI18n filtered by the locale column
* @method ChildSelectionImageI18n findOneByTitle(string $title) Return the first ChildSelectionImageI18n filtered by the title column
* @method ChildSelectionImageI18n findOneByDescription(string $description) Return the first ChildSelectionImageI18n filtered by the description column
* @method ChildSelectionImageI18n findOneByChapo(string $chapo) Return the first ChildSelectionImageI18n filtered by the chapo column
* @method ChildSelectionImageI18n findOneByPostscriptum(string $postscriptum) Return the first ChildSelectionImageI18n filtered by the postscriptum column
*
* @method array findById(int $id) Return ChildSelectionImageI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildSelectionImageI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildSelectionImageI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildSelectionImageI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildSelectionImageI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildSelectionImageI18n objects filtered by the postscriptum column
*
*/
abstract class SelectionImageI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Selection\Model\Base\SelectionImageI18nQuery 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 = '\\Selection\\Model\\SelectionImageI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSelectionImageI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSelectionImageI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Selection\Model\SelectionImageI18nQuery) {
return $criteria;
}
$query = new \Selection\Model\SelectionImageI18nQuery();
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 ChildSelectionImageI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SelectionImageI18nTableMap::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(SelectionImageI18nTableMap::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 ChildSelectionImageI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM selection_image_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 ChildSelectionImageI18n();
$obj->hydrate($row);
SelectionImageI18nTableMap::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 ChildSelectionImageI18n|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 ChildSelectionImageI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(SelectionImageI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(SelectionImageI18nTableMap::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 ChildSelectionImageI18nQuery 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(SelectionImageI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(SelectionImageI18nTableMap::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 filterBySelectionImage()
*
* @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 ChildSelectionImageI18nQuery 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(SelectionImageI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SelectionImageI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionImageI18nTableMap::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 ChildSelectionImageI18nQuery 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(SelectionImageI18nTableMap::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 ChildSelectionImageI18nQuery 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(SelectionImageI18nTableMap::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 ChildSelectionImageI18nQuery 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(SelectionImageI18nTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionImageI18nQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionImageI18nTableMap::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $postscriptum The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionImageI18nQuery The current query, for fluid interface
*/
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionImageI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query by a related \Selection\Model\SelectionImage object
*
* @param \Selection\Model\SelectionImage|ObjectCollection $selectionImage The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionImageI18nQuery The current query, for fluid interface
*/
public function filterBySelectionImage($selectionImage, $comparison = null)
{
if ($selectionImage instanceof \Selection\Model\SelectionImage) {
return $this
->addUsingAlias(SelectionImageI18nTableMap::ID, $selectionImage->getId(), $comparison);
} elseif ($selectionImage instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionImageI18nTableMap::ID, $selectionImage->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySelectionImage() only accepts arguments of type \Selection\Model\SelectionImage or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SelectionImage relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionImageI18nQuery The current query, for fluid interface
*/
public function joinSelectionImage($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SelectionImage');
// 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, 'SelectionImage');
}
return $this;
}
/**
* Use the SelectionImage relation SelectionImage 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 \Selection\Model\SelectionImageQuery A secondary query class using the current class as primary query
*/
public function useSelectionImageQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinSelectionImage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SelectionImage', '\Selection\Model\SelectionImageQuery');
}
/**
* Exclude object from result
*
* @param ChildSelectionImageI18n $selectionImageI18n Object to remove from the list of results
*
* @return ChildSelectionImageI18nQuery The current query, for fluid interface
*/
public function prune($selectionImageI18n = null)
{
if ($selectionImageI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(SelectionImageI18nTableMap::ID), $selectionImageI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(SelectionImageI18nTableMap::LOCALE), $selectionImageI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the selection_image_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(SelectionImageI18nTableMap::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).
SelectionImageI18nTableMap::clearInstancePool();
SelectionImageI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSelectionImageI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSelectionImageI18n 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(SelectionImageI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SelectionImageI18nTableMap::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();
SelectionImageI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SelectionImageI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // SelectionImageI18nQuery

View File

@@ -0,0 +1,891 @@
<?php
namespace Selection\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 Selection\Model\SelectionImage as ChildSelectionImage;
use Selection\Model\SelectionImageI18nQuery as ChildSelectionImageI18nQuery;
use Selection\Model\SelectionImageQuery as ChildSelectionImageQuery;
use Selection\Model\Map\SelectionImageTableMap;
/**
* Base class that represents a query for the 'selection_image' table.
*
*
*
* @method ChildSelectionImageQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildSelectionImageQuery orderBySelectionId($order = Criteria::ASC) Order by the selection_id column
* @method ChildSelectionImageQuery orderByFile($order = Criteria::ASC) Order by the file column
* @method ChildSelectionImageQuery orderByVisible($order = Criteria::ASC) Order by the visible column
* @method ChildSelectionImageQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildSelectionImageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildSelectionImageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildSelectionImageQuery groupById() Group by the id column
* @method ChildSelectionImageQuery groupBySelectionId() Group by the selection_id column
* @method ChildSelectionImageQuery groupByFile() Group by the file column
* @method ChildSelectionImageQuery groupByVisible() Group by the visible column
* @method ChildSelectionImageQuery groupByPosition() Group by the position column
* @method ChildSelectionImageQuery groupByCreatedAt() Group by the created_at column
* @method ChildSelectionImageQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildSelectionImageQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSelectionImageQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSelectionImageQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSelectionImageQuery leftJoinSelection($relationAlias = null) Adds a LEFT JOIN clause to the query using the Selection relation
* @method ChildSelectionImageQuery rightJoinSelection($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Selection relation
* @method ChildSelectionImageQuery innerJoinSelection($relationAlias = null) Adds a INNER JOIN clause to the query using the Selection relation
*
* @method ChildSelectionImageQuery leftJoinSelectionImageI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the SelectionImageI18n relation
* @method ChildSelectionImageQuery rightJoinSelectionImageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SelectionImageI18n relation
* @method ChildSelectionImageQuery innerJoinSelectionImageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the SelectionImageI18n relation
*
* @method ChildSelectionImage findOne(ConnectionInterface $con = null) Return the first ChildSelectionImage matching the query
* @method ChildSelectionImage findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSelectionImage matching the query, or a new ChildSelectionImage object populated from the query conditions when no match is found
*
* @method ChildSelectionImage findOneById(int $id) Return the first ChildSelectionImage filtered by the id column
* @method ChildSelectionImage findOneBySelectionId(int $selection_id) Return the first ChildSelectionImage filtered by the selection_id column
* @method ChildSelectionImage findOneByFile(string $file) Return the first ChildSelectionImage filtered by the file column
* @method ChildSelectionImage findOneByVisible(int $visible) Return the first ChildSelectionImage filtered by the visible column
* @method ChildSelectionImage findOneByPosition(int $position) Return the first ChildSelectionImage filtered by the position column
* @method ChildSelectionImage findOneByCreatedAt(string $created_at) Return the first ChildSelectionImage filtered by the created_at column
* @method ChildSelectionImage findOneByUpdatedAt(string $updated_at) Return the first ChildSelectionImage filtered by the updated_at column
*
* @method array findById(int $id) Return ChildSelectionImage objects filtered by the id column
* @method array findBySelectionId(int $selection_id) Return ChildSelectionImage objects filtered by the selection_id column
* @method array findByFile(string $file) Return ChildSelectionImage objects filtered by the file column
* @method array findByVisible(int $visible) Return ChildSelectionImage objects filtered by the visible column
* @method array findByPosition(int $position) Return ChildSelectionImage objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildSelectionImage objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildSelectionImage objects filtered by the updated_at column
*
*/
abstract class SelectionImageQuery extends ModelCriteria
{
/**
* Initializes internal state of \Selection\Model\Base\SelectionImageQuery 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 = '\\Selection\\Model\\SelectionImage', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSelectionImageQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSelectionImageQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Selection\Model\SelectionImageQuery) {
return $criteria;
}
$query = new \Selection\Model\SelectionImageQuery();
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 ChildSelectionImage|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SelectionImageTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(SelectionImageTableMap::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 ChildSelectionImage A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, SELECTION_ID, FILE, VISIBLE, POSITION, CREATED_AT, UPDATED_AT FROM selection_image 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 ChildSelectionImage();
$obj->hydrate($row);
SelectionImageTableMap::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 ChildSelectionImage|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 ChildSelectionImageQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(SelectionImageTableMap::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 ChildSelectionImageQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(SelectionImageTableMap::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 ChildSelectionImageQuery 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(SelectionImageTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(SelectionImageTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionImageTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the selection_id column
*
* Example usage:
* <code>
* $query->filterBySelectionId(1234); // WHERE selection_id = 1234
* $query->filterBySelectionId(array(12, 34)); // WHERE selection_id IN (12, 34)
* $query->filterBySelectionId(array('min' => 12)); // WHERE selection_id > 12
* </code>
*
* @see filterBySelection()
*
* @param mixed $selectionId 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 ChildSelectionImageQuery The current query, for fluid interface
*/
public function filterBySelectionId($selectionId = null, $comparison = null)
{
if (is_array($selectionId)) {
$useMinMax = false;
if (isset($selectionId['min'])) {
$this->addUsingAlias(SelectionImageTableMap::SELECTION_ID, $selectionId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($selectionId['max'])) {
$this->addUsingAlias(SelectionImageTableMap::SELECTION_ID, $selectionId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionImageTableMap::SELECTION_ID, $selectionId, $comparison);
}
/**
* Filter the query on the file column
*
* Example usage:
* <code>
* $query->filterByFile('fooValue'); // WHERE file = 'fooValue'
* $query->filterByFile('%fooValue%'); // WHERE file LIKE '%fooValue%'
* </code>
*
* @param string $file 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 ChildSelectionImageQuery The current query, for fluid interface
*/
public function filterByFile($file = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($file)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $file)) {
$file = str_replace('*', '%', $file);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SelectionImageTableMap::FILE, $file, $comparison);
}
/**
* Filter the query on the visible column
*
* Example usage:
* <code>
* $query->filterByVisible(1234); // WHERE visible = 1234
* $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
* $query->filterByVisible(array('min' => 12)); // WHERE visible > 12
* </code>
*
* @param mixed $visible The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function filterByVisible($visible = null, $comparison = null)
{
if (is_array($visible)) {
$useMinMax = false;
if (isset($visible['min'])) {
$this->addUsingAlias(SelectionImageTableMap::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($visible['max'])) {
$this->addUsingAlias(SelectionImageTableMap::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionImageTableMap::VISIBLE, $visible, $comparison);
}
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionImageQuery 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(SelectionImageTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(SelectionImageTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionImageTableMap::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 ChildSelectionImageQuery 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(SelectionImageTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(SelectionImageTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionImageTableMap::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 ChildSelectionImageQuery 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(SelectionImageTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(SelectionImageTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionImageTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Selection\Model\Selection object
*
* @param \Selection\Model\Selection|ObjectCollection $selection The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function filterBySelection($selection, $comparison = null)
{
if ($selection instanceof \Selection\Model\Selection) {
return $this
->addUsingAlias(SelectionImageTableMap::SELECTION_ID, $selection->getId(), $comparison);
} elseif ($selection instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionImageTableMap::SELECTION_ID, $selection->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySelection() only accepts arguments of type \Selection\Model\Selection or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Selection relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function joinSelection($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Selection');
// 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, 'Selection');
}
return $this;
}
/**
* Use the Selection relation Selection 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 \Selection\Model\SelectionQuery A secondary query class using the current class as primary query
*/
public function useSelectionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSelection($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Selection', '\Selection\Model\SelectionQuery');
}
/**
* Filter the query by a related \Selection\Model\SelectionImageI18n object
*
* @param \Selection\Model\SelectionImageI18n|ObjectCollection $selectionImageI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function filterBySelectionImageI18n($selectionImageI18n, $comparison = null)
{
if ($selectionImageI18n instanceof \Selection\Model\SelectionImageI18n) {
return $this
->addUsingAlias(SelectionImageTableMap::ID, $selectionImageI18n->getId(), $comparison);
} elseif ($selectionImageI18n instanceof ObjectCollection) {
return $this
->useSelectionImageI18nQuery()
->filterByPrimaryKeys($selectionImageI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterBySelectionImageI18n() only accepts arguments of type \Selection\Model\SelectionImageI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the SelectionImageI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function joinSelectionImageI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('SelectionImageI18n');
// 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, 'SelectionImageI18n');
}
return $this;
}
/**
* Use the SelectionImageI18n relation SelectionImageI18n 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 \Selection\Model\SelectionImageI18nQuery A secondary query class using the current class as primary query
*/
public function useSelectionImageI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinSelectionImageI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SelectionImageI18n', '\Selection\Model\SelectionImageI18nQuery');
}
/**
* Exclude object from result
*
* @param ChildSelectionImage $selectionImage Object to remove from the list of results
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function prune($selectionImage = null)
{
if ($selectionImage) {
$this->addUsingAlias(SelectionImageTableMap::ID, $selectionImage->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the selection_image 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(SelectionImageTableMap::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).
SelectionImageTableMap::clearInstancePool();
SelectionImageTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSelectionImage or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSelectionImage 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(SelectionImageTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SelectionImageTableMap::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();
SelectionImageTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SelectionImageTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(SelectionImageTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(SelectionImageTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionImageTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionImageTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionImageTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildSelectionImageQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionImageTableMap::CREATED_AT);
}
// 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 ChildSelectionImageQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'SelectionImageI18n';
return $this
->joinSelectionImageI18n($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 ChildSelectionImageQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('SelectionImageI18n');
$this->with['SelectionImageI18n']->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 ChildSelectionImageI18nQuery 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 : 'SelectionImageI18n', '\Selection\Model\SelectionImageI18nQuery');
}
} // SelectionImageQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,774 @@
<?php
namespace Selection\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 Selection\Model\SelectionProduct as ChildSelectionProduct;
use Selection\Model\SelectionProductQuery as ChildSelectionProductQuery;
use Selection\Model\Map\SelectionProductTableMap;
use Thelia\Model\Product;
/**
* Base class that represents a query for the 'selection_product' table.
*
*
*
* @method ChildSelectionProductQuery orderBySelectionId($order = Criteria::ASC) Order by the selection_id column
* @method ChildSelectionProductQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
* @method ChildSelectionProductQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildSelectionProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildSelectionProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildSelectionProductQuery groupBySelectionId() Group by the selection_id column
* @method ChildSelectionProductQuery groupByProductId() Group by the product_id column
* @method ChildSelectionProductQuery groupByPosition() Group by the position column
* @method ChildSelectionProductQuery groupByCreatedAt() Group by the created_at column
* @method ChildSelectionProductQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildSelectionProductQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildSelectionProductQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildSelectionProductQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildSelectionProductQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
* @method ChildSelectionProductQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
* @method ChildSelectionProductQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
*
* @method ChildSelectionProductQuery leftJoinSelection($relationAlias = null) Adds a LEFT JOIN clause to the query using the Selection relation
* @method ChildSelectionProductQuery rightJoinSelection($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Selection relation
* @method ChildSelectionProductQuery innerJoinSelection($relationAlias = null) Adds a INNER JOIN clause to the query using the Selection relation
*
* @method ChildSelectionProduct findOne(ConnectionInterface $con = null) Return the first ChildSelectionProduct matching the query
* @method ChildSelectionProduct findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSelectionProduct matching the query, or a new ChildSelectionProduct object populated from the query conditions when no match is found
*
* @method ChildSelectionProduct findOneBySelectionId(int $selection_id) Return the first ChildSelectionProduct filtered by the selection_id column
* @method ChildSelectionProduct findOneByProductId(int $product_id) Return the first ChildSelectionProduct filtered by the product_id column
* @method ChildSelectionProduct findOneByPosition(int $position) Return the first ChildSelectionProduct filtered by the position column
* @method ChildSelectionProduct findOneByCreatedAt(string $created_at) Return the first ChildSelectionProduct filtered by the created_at column
* @method ChildSelectionProduct findOneByUpdatedAt(string $updated_at) Return the first ChildSelectionProduct filtered by the updated_at column
*
* @method array findBySelectionId(int $selection_id) Return ChildSelectionProduct objects filtered by the selection_id column
* @method array findByProductId(int $product_id) Return ChildSelectionProduct objects filtered by the product_id column
* @method array findByPosition(int $position) Return ChildSelectionProduct objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildSelectionProduct objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildSelectionProduct objects filtered by the updated_at column
*
*/
abstract class SelectionProductQuery extends ModelCriteria
{
/**
* Initializes internal state of \Selection\Model\Base\SelectionProductQuery 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 = '\\Selection\\Model\\SelectionProduct', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildSelectionProductQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildSelectionProductQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Selection\Model\SelectionProductQuery) {
return $criteria;
}
$query = new \Selection\Model\SelectionProductQuery();
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[$selection_id, $product_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildSelectionProduct|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = SelectionProductTableMap::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(SelectionProductTableMap::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 ChildSelectionProduct A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT SELECTION_ID, PRODUCT_ID, POSITION, CREATED_AT, UPDATED_AT FROM selection_product WHERE SELECTION_ID = :p0 AND PRODUCT_ID = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildSelectionProduct();
$obj->hydrate($row);
SelectionProductTableMap::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 ChildSelectionProduct|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 ChildSelectionProductQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(SelectionProductTableMap::SELECTION_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(SelectionProductTableMap::PRODUCT_ID, $key[1], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildSelectionProductQuery 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(SelectionProductTableMap::SELECTION_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(SelectionProductTableMap::PRODUCT_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the selection_id column
*
* Example usage:
* <code>
* $query->filterBySelectionId(1234); // WHERE selection_id = 1234
* $query->filterBySelectionId(array(12, 34)); // WHERE selection_id IN (12, 34)
* $query->filterBySelectionId(array('min' => 12)); // WHERE selection_id > 12
* </code>
*
* @see filterBySelection()
*
* @param mixed $selectionId 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 ChildSelectionProductQuery The current query, for fluid interface
*/
public function filterBySelectionId($selectionId = null, $comparison = null)
{
if (is_array($selectionId)) {
$useMinMax = false;
if (isset($selectionId['min'])) {
$this->addUsingAlias(SelectionProductTableMap::SELECTION_ID, $selectionId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($selectionId['max'])) {
$this->addUsingAlias(SelectionProductTableMap::SELECTION_ID, $selectionId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionProductTableMap::SELECTION_ID, $selectionId, $comparison);
}
/**
* Filter the query on the product_id column
*
* Example usage:
* <code>
* $query->filterByProductId(1234); // WHERE product_id = 1234
* $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34)
* $query->filterByProductId(array('min' => 12)); // WHERE product_id > 12
* </code>
*
* @see filterByProduct()
*
* @param mixed $productId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function filterByProductId($productId = null, $comparison = null)
{
if (is_array($productId)) {
$useMinMax = false;
if (isset($productId['min'])) {
$this->addUsingAlias(SelectionProductTableMap::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($productId['max'])) {
$this->addUsingAlias(SelectionProductTableMap::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionProductTableMap::PRODUCT_ID, $productId, $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 ChildSelectionProductQuery 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(SelectionProductTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(SelectionProductTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionProductTableMap::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 ChildSelectionProductQuery 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(SelectionProductTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(SelectionProductTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionProductTableMap::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 ChildSelectionProductQuery 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(SelectionProductTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(SelectionProductTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(SelectionProductTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Product object
*
* @param \Thelia\Model\Product|ObjectCollection $product The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function filterByProduct($product, $comparison = null)
{
if ($product instanceof \Thelia\Model\Product) {
return $this
->addUsingAlias(SelectionProductTableMap::PRODUCT_ID, $product->getId(), $comparison);
} elseif ($product instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionProductTableMap::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Product relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Product');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Product');
}
return $this;
}
/**
* Use the Product relation Product object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
*/
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinProduct($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
}
/**
* Filter the query by a related \Selection\Model\Selection object
*
* @param \Selection\Model\Selection|ObjectCollection $selection The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function filterBySelection($selection, $comparison = null)
{
if ($selection instanceof \Selection\Model\Selection) {
return $this
->addUsingAlias(SelectionProductTableMap::SELECTION_ID, $selection->getId(), $comparison);
} elseif ($selection instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(SelectionProductTableMap::SELECTION_ID, $selection->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterBySelection() only accepts arguments of type \Selection\Model\Selection or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Selection relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function joinSelection($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Selection');
// 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, 'Selection');
}
return $this;
}
/**
* Use the Selection relation Selection 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 \Selection\Model\SelectionQuery A secondary query class using the current class as primary query
*/
public function useSelectionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSelection($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Selection', '\Selection\Model\SelectionQuery');
}
/**
* Exclude object from result
*
* @param ChildSelectionProduct $selectionProduct Object to remove from the list of results
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function prune($selectionProduct = null)
{
if ($selectionProduct) {
$this->addCond('pruneCond0', $this->getAliasedColName(SelectionProductTableMap::SELECTION_ID), $selectionProduct->getSelectionId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(SelectionProductTableMap::PRODUCT_ID), $selectionProduct->getProductId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the selection_product 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(SelectionProductTableMap::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).
SelectionProductTableMap::clearInstancePool();
SelectionProductTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildSelectionProduct or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildSelectionProduct 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(SelectionProductTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(SelectionProductTableMap::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();
SelectionProductTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
SelectionProductTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(SelectionProductTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(SelectionProductTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionProductTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionProductTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(SelectionProductTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildSelectionProductQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(SelectionProductTableMap::CREATED_AT);
}
} // SelectionProductQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,445 @@
<?php
namespace Selection\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 Selection\Model\SelectionContainerAssociatedSelection;
use Selection\Model\SelectionContainerAssociatedSelectionQuery;
/**
* This class defines the structure of the 'selection_container_associated_selection' 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 SelectionContainerAssociatedSelectionTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionContainerAssociatedSelectionTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection_container_associated_selection';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\SelectionContainerAssociatedSelection';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.SelectionContainerAssociatedSelection';
/**
* The total number of columns
*/
const NUM_COLUMNS = 5;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the ID field
*/
const ID = 'selection_container_associated_selection.ID';
/**
* the column name for the SELECTION_CONTAINER_ID field
*/
const SELECTION_CONTAINER_ID = 'selection_container_associated_selection.SELECTION_CONTAINER_ID';
/**
* the column name for the SELECTION_ID field
*/
const SELECTION_ID = 'selection_container_associated_selection.SELECTION_ID';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'selection_container_associated_selection.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'selection_container_associated_selection.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'SelectionContainerId', 'SelectionId', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'selectionContainerId', 'selectionId', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(SelectionContainerAssociatedSelectionTableMap::ID, SelectionContainerAssociatedSelectionTableMap::SELECTION_CONTAINER_ID, SelectionContainerAssociatedSelectionTableMap::SELECTION_ID, SelectionContainerAssociatedSelectionTableMap::CREATED_AT, SelectionContainerAssociatedSelectionTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'SELECTION_CONTAINER_ID', 'SELECTION_ID', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'selection_container_id', 'selection_id', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'SelectionContainerId' => 1, 'SelectionId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'selectionContainerId' => 1, 'selectionId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(SelectionContainerAssociatedSelectionTableMap::ID => 0, SelectionContainerAssociatedSelectionTableMap::SELECTION_CONTAINER_ID => 1, SelectionContainerAssociatedSelectionTableMap::SELECTION_ID => 2, SelectionContainerAssociatedSelectionTableMap::CREATED_AT => 3, SelectionContainerAssociatedSelectionTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'SELECTION_CONTAINER_ID' => 1, 'SELECTION_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('id' => 0, 'selection_container_id' => 1, 'selection_id' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
* 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('selection_container_associated_selection');
$this->setPhpName('SelectionContainerAssociatedSelection');
$this->setClassName('\\Selection\\Model\\SelectionContainerAssociatedSelection');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('SELECTION_CONTAINER_ID', 'SelectionContainerId', 'INTEGER', 'selection_container', 'ID', true, null, null);
$this->addForeignKey('SELECTION_ID', 'SelectionId', 'INTEGER', 'selection', 'ID', 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('SelectionContainer', '\\Selection\\Model\\SelectionContainer', RelationMap::MANY_TO_ONE, array('selection_container_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Selection', '\\Selection\\Model\\Selection', RelationMap::MANY_TO_ONE, array('selection_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*/
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row resultset row.
* @param int $offset The 0-based offset for reading from the resultset row.
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
*
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
return (int) $row[
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
}
/**
* The class that the tableMap will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is translated into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? SelectionContainerAssociatedSelectionTableMap::CLASS_DEFAULT : SelectionContainerAssociatedSelectionTableMap::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 (SelectionContainerAssociatedSelection object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionContainerAssociatedSelectionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionContainerAssociatedSelectionTableMap::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 + SelectionContainerAssociatedSelectionTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionContainerAssociatedSelectionTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionContainerAssociatedSelectionTableMap::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 = SelectionContainerAssociatedSelectionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionContainerAssociatedSelectionTableMap::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;
SelectionContainerAssociatedSelectionTableMap::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(SelectionContainerAssociatedSelectionTableMap::ID);
$criteria->addSelectColumn(SelectionContainerAssociatedSelectionTableMap::SELECTION_CONTAINER_ID);
$criteria->addSelectColumn(SelectionContainerAssociatedSelectionTableMap::SELECTION_ID);
$criteria->addSelectColumn(SelectionContainerAssociatedSelectionTableMap::CREATED_AT);
$criteria->addSelectColumn(SelectionContainerAssociatedSelectionTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.SELECTION_CONTAINER_ID');
$criteria->addSelectColumn($alias . '.SELECTION_ID');
$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(SelectionContainerAssociatedSelectionTableMap::DATABASE_NAME)->getTable(SelectionContainerAssociatedSelectionTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionContainerAssociatedSelectionTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionContainerAssociatedSelectionTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionContainerAssociatedSelectionTableMap());
}
}
/**
* Performs a DELETE on the database, given a SelectionContainerAssociatedSelection or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SelectionContainerAssociatedSelection 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(SelectionContainerAssociatedSelectionTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\SelectionContainerAssociatedSelection) { // 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(SelectionContainerAssociatedSelectionTableMap::DATABASE_NAME);
$criteria->add(SelectionContainerAssociatedSelectionTableMap::ID, (array) $values, Criteria::IN);
}
$query = SelectionContainerAssociatedSelectionQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionContainerAssociatedSelectionTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionContainerAssociatedSelectionTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection_container_associated_selection 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 SelectionContainerAssociatedSelectionQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SelectionContainerAssociatedSelection or Criteria object.
*
* @param mixed $criteria Criteria or SelectionContainerAssociatedSelection 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(SelectionContainerAssociatedSelectionTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SelectionContainerAssociatedSelection object
}
// Set the correct dbName
$query = SelectionContainerAssociatedSelectionQuery::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;
}
} // SelectionContainerAssociatedSelectionTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionContainerAssociatedSelectionTableMap::buildTableMap();

View File

@@ -0,0 +1,522 @@
<?php
namespace Selection\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 Selection\Model\SelectionContainerI18n;
use Selection\Model\SelectionContainerI18nQuery;
/**
* This class defines the structure of the 'selection_container_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 SelectionContainerI18nTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionContainerI18nTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection_container_i18n';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\SelectionContainerI18n';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.SelectionContainerI18n';
/**
* The total number of columns
*/
const NUM_COLUMNS = 9;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 9;
/**
* the column name for the ID field
*/
const ID = 'selection_container_i18n.ID';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'selection_container_i18n.LOCALE';
/**
* the column name for the TITLE field
*/
const TITLE = 'selection_container_i18n.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'selection_container_i18n.DESCRIPTION';
/**
* the column name for the CHAPO field
*/
const CHAPO = 'selection_container_i18n.CHAPO';
/**
* the column name for the POSTSCRIPTUM field
*/
const POSTSCRIPTUM = 'selection_container_i18n.POSTSCRIPTUM';
/**
* the column name for the META_TITLE field
*/
const META_TITLE = 'selection_container_i18n.META_TITLE';
/**
* the column name for the META_DESCRIPTION field
*/
const META_DESCRIPTION = 'selection_container_i18n.META_DESCRIPTION';
/**
* the column name for the META_KEYWORDS field
*/
const META_KEYWORDS = 'selection_container_i18n.META_KEYWORDS';
/**
* 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', 'Chapo', 'Postscriptum', 'MetaTitle', 'MetaDescription', 'MetaKeywords', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'metaTitle', 'metaDescription', 'metaKeywords', ),
self::TYPE_COLNAME => array(SelectionContainerI18nTableMap::ID, SelectionContainerI18nTableMap::LOCALE, SelectionContainerI18nTableMap::TITLE, SelectionContainerI18nTableMap::DESCRIPTION, SelectionContainerI18nTableMap::CHAPO, SelectionContainerI18nTableMap::POSTSCRIPTUM, SelectionContainerI18nTableMap::META_TITLE, SelectionContainerI18nTableMap::META_DESCRIPTION, SelectionContainerI18nTableMap::META_KEYWORDS, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS', ),
self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'meta_title', 'meta_description', 'meta_keywords', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, 'MetaTitle' => 6, 'MetaDescription' => 7, 'MetaKeywords' => 8, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'metaTitle' => 6, 'metaDescription' => 7, 'metaKeywords' => 8, ),
self::TYPE_COLNAME => array(SelectionContainerI18nTableMap::ID => 0, SelectionContainerI18nTableMap::LOCALE => 1, SelectionContainerI18nTableMap::TITLE => 2, SelectionContainerI18nTableMap::DESCRIPTION => 3, SelectionContainerI18nTableMap::CHAPO => 4, SelectionContainerI18nTableMap::POSTSCRIPTUM => 5, SelectionContainerI18nTableMap::META_TITLE => 6, SelectionContainerI18nTableMap::META_DESCRIPTION => 7, SelectionContainerI18nTableMap::META_KEYWORDS => 8, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, 'META_TITLE' => 6, 'META_DESCRIPTION' => 7, 'META_KEYWORDS' => 8, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'meta_title' => 6, 'meta_description' => 7, 'meta_keywords' => 8, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* 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('selection_container_i18n');
$this->setPhpName('SelectionContainerI18n');
$this->setClassName('\\Selection\\Model\\SelectionContainerI18n');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'selection_container', 'ID', true, null, null);
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
$this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_TITLE', 'MetaTitle', 'VARCHAR', false, 255, null);
$this->addColumn('META_DESCRIPTION', 'MetaDescription', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_KEYWORDS', 'MetaKeywords', 'LONGVARCHAR', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('SelectionContainer', '\\Selection\\Model\\SelectionContainer', 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 \Selection\Model\SelectionContainerI18n $obj A \Selection\Model\SelectionContainerI18n 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 \Selection\Model\SelectionContainerI18n object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Selection\Model\SelectionContainerI18n) {
$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 \Selection\Model\SelectionContainerI18n 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 ? SelectionContainerI18nTableMap::CLASS_DEFAULT : SelectionContainerI18nTableMap::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 (SelectionContainerI18n object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionContainerI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionContainerI18nTableMap::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 + SelectionContainerI18nTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionContainerI18nTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionContainerI18nTableMap::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 = SelectionContainerI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionContainerI18nTableMap::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;
SelectionContainerI18nTableMap::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(SelectionContainerI18nTableMap::ID);
$criteria->addSelectColumn(SelectionContainerI18nTableMap::LOCALE);
$criteria->addSelectColumn(SelectionContainerI18nTableMap::TITLE);
$criteria->addSelectColumn(SelectionContainerI18nTableMap::DESCRIPTION);
$criteria->addSelectColumn(SelectionContainerI18nTableMap::CHAPO);
$criteria->addSelectColumn(SelectionContainerI18nTableMap::POSTSCRIPTUM);
$criteria->addSelectColumn(SelectionContainerI18nTableMap::META_TITLE);
$criteria->addSelectColumn(SelectionContainerI18nTableMap::META_DESCRIPTION);
$criteria->addSelectColumn(SelectionContainerI18nTableMap::META_KEYWORDS);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.CHAPO');
$criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
$criteria->addSelectColumn($alias . '.META_TITLE');
$criteria->addSelectColumn($alias . '.META_DESCRIPTION');
$criteria->addSelectColumn($alias . '.META_KEYWORDS');
}
}
/**
* 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(SelectionContainerI18nTableMap::DATABASE_NAME)->getTable(SelectionContainerI18nTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionContainerI18nTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionContainerI18nTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionContainerI18nTableMap());
}
}
/**
* Performs a DELETE on the database, given a SelectionContainerI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SelectionContainerI18n 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(SelectionContainerI18nTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\SelectionContainerI18n) { // 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(SelectionContainerI18nTableMap::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(SelectionContainerI18nTableMap::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(SelectionContainerI18nTableMap::LOCALE, $value[1]));
$criteria->addOr($criterion);
}
}
$query = SelectionContainerI18nQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionContainerI18nTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionContainerI18nTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection_container_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 SelectionContainerI18nQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SelectionContainerI18n or Criteria object.
*
* @param mixed $criteria Criteria or SelectionContainerI18n 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(SelectionContainerI18nTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SelectionContainerI18n object
}
// Set the correct dbName
$query = SelectionContainerI18nQuery::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;
}
} // SelectionContainerI18nTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionContainerI18nTableMap::buildTableMap();

View File

@@ -0,0 +1,498 @@
<?php
namespace Selection\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 Selection\Model\SelectionContainerImageI18n;
use Selection\Model\SelectionContainerImageI18nQuery;
/**
* This class defines the structure of the 'selection_container_image_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 SelectionContainerImageI18nTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionContainerImageI18nTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection_container_image_i18n';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\SelectionContainerImageI18n';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.SelectionContainerImageI18n';
/**
* The total number of columns
*/
const NUM_COLUMNS = 6;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 6;
/**
* the column name for the ID field
*/
const ID = 'selection_container_image_i18n.ID';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'selection_container_image_i18n.LOCALE';
/**
* the column name for the TITLE field
*/
const TITLE = 'selection_container_image_i18n.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'selection_container_image_i18n.DESCRIPTION';
/**
* the column name for the CHAPO field
*/
const CHAPO = 'selection_container_image_i18n.CHAPO';
/**
* the column name for the POSTSCRIPTUM field
*/
const POSTSCRIPTUM = 'selection_container_image_i18n.POSTSCRIPTUM';
/**
* 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', 'Chapo', 'Postscriptum', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
self::TYPE_COLNAME => array(SelectionContainerImageI18nTableMap::ID, SelectionContainerImageI18nTableMap::LOCALE, SelectionContainerImageI18nTableMap::TITLE, SelectionContainerImageI18nTableMap::DESCRIPTION, SelectionContainerImageI18nTableMap::CHAPO, SelectionContainerImageI18nTableMap::POSTSCRIPTUM, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
self::TYPE_COLNAME => array(SelectionContainerImageI18nTableMap::ID => 0, SelectionContainerImageI18nTableMap::LOCALE => 1, SelectionContainerImageI18nTableMap::TITLE => 2, SelectionContainerImageI18nTableMap::DESCRIPTION => 3, SelectionContainerImageI18nTableMap::CHAPO => 4, SelectionContainerImageI18nTableMap::POSTSCRIPTUM => 5, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('selection_container_image_i18n');
$this->setPhpName('SelectionContainerImageI18n');
$this->setClassName('\\Selection\\Model\\SelectionContainerImageI18n');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'selection_container_image', 'ID', true, null, null);
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
$this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('SelectionContainerImage', '\\Selection\\Model\\SelectionContainerImage', 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 \Selection\Model\SelectionContainerImageI18n $obj A \Selection\Model\SelectionContainerImageI18n 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 \Selection\Model\SelectionContainerImageI18n object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Selection\Model\SelectionContainerImageI18n) {
$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 \Selection\Model\SelectionContainerImageI18n 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 ? SelectionContainerImageI18nTableMap::CLASS_DEFAULT : SelectionContainerImageI18nTableMap::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 (SelectionContainerImageI18n object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionContainerImageI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionContainerImageI18nTableMap::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 + SelectionContainerImageI18nTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionContainerImageI18nTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionContainerImageI18nTableMap::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 = SelectionContainerImageI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionContainerImageI18nTableMap::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;
SelectionContainerImageI18nTableMap::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(SelectionContainerImageI18nTableMap::ID);
$criteria->addSelectColumn(SelectionContainerImageI18nTableMap::LOCALE);
$criteria->addSelectColumn(SelectionContainerImageI18nTableMap::TITLE);
$criteria->addSelectColumn(SelectionContainerImageI18nTableMap::DESCRIPTION);
$criteria->addSelectColumn(SelectionContainerImageI18nTableMap::CHAPO);
$criteria->addSelectColumn(SelectionContainerImageI18nTableMap::POSTSCRIPTUM);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.CHAPO');
$criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
}
}
/**
* 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(SelectionContainerImageI18nTableMap::DATABASE_NAME)->getTable(SelectionContainerImageI18nTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionContainerImageI18nTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionContainerImageI18nTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionContainerImageI18nTableMap());
}
}
/**
* Performs a DELETE on the database, given a SelectionContainerImageI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SelectionContainerImageI18n 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(SelectionContainerImageI18nTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\SelectionContainerImageI18n) { // 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(SelectionContainerImageI18nTableMap::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(SelectionContainerImageI18nTableMap::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(SelectionContainerImageI18nTableMap::LOCALE, $value[1]));
$criteria->addOr($criterion);
}
}
$query = SelectionContainerImageI18nQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionContainerImageI18nTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionContainerImageI18nTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection_container_image_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 SelectionContainerImageI18nQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SelectionContainerImageI18n or Criteria object.
*
* @param mixed $criteria Criteria or SelectionContainerImageI18n 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(SelectionContainerImageI18nTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SelectionContainerImageI18n object
}
// Set the correct dbName
$query = SelectionContainerImageI18nQuery::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;
}
} // SelectionContainerImageI18nTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionContainerImageI18nTableMap::buildTableMap();

View File

@@ -0,0 +1,480 @@
<?php
namespace Selection\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 Selection\Model\SelectionContainerImage;
use Selection\Model\SelectionContainerImageQuery;
/**
* This class defines the structure of the 'selection_container_image' 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 SelectionContainerImageTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionContainerImageTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection_container_image';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\SelectionContainerImage';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.SelectionContainerImage';
/**
* The total number of columns
*/
const NUM_COLUMNS = 7;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 7;
/**
* the column name for the ID field
*/
const ID = 'selection_container_image.ID';
/**
* the column name for the SELECTION_CONTAINER_ID field
*/
const SELECTION_CONTAINER_ID = 'selection_container_image.SELECTION_CONTAINER_ID';
/**
* the column name for the FILE field
*/
const FILE = 'selection_container_image.FILE';
/**
* the column name for the VISIBLE field
*/
const VISIBLE = 'selection_container_image.VISIBLE';
/**
* the column name for the POSITION field
*/
const POSITION = 'selection_container_image.POSITION';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'selection_container_image.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'selection_container_image.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', 'SelectionContainerId', 'File', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'selectionContainerId', 'file', 'visible', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(SelectionContainerImageTableMap::ID, SelectionContainerImageTableMap::SELECTION_CONTAINER_ID, SelectionContainerImageTableMap::FILE, SelectionContainerImageTableMap::VISIBLE, SelectionContainerImageTableMap::POSITION, SelectionContainerImageTableMap::CREATED_AT, SelectionContainerImageTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'SELECTION_CONTAINER_ID', 'FILE', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'selection_container_id', 'file', 'visible', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'SelectionContainerId' => 1, 'File' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'selectionContainerId' => 1, 'file' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
self::TYPE_COLNAME => array(SelectionContainerImageTableMap::ID => 0, SelectionContainerImageTableMap::SELECTION_CONTAINER_ID => 1, SelectionContainerImageTableMap::FILE => 2, SelectionContainerImageTableMap::VISIBLE => 3, SelectionContainerImageTableMap::POSITION => 4, SelectionContainerImageTableMap::CREATED_AT => 5, SelectionContainerImageTableMap::UPDATED_AT => 6, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'SELECTION_CONTAINER_ID' => 1, 'FILE' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
self::TYPE_FIELDNAME => array('id' => 0, 'selection_container_id' => 1, 'file' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
* 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('selection_container_image');
$this->setPhpName('SelectionContainerImage');
$this->setClassName('\\Selection\\Model\\SelectionContainerImage');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('SELECTION_CONTAINER_ID', 'SelectionContainerId', 'INTEGER', 'selection_container', 'ID', true, null, null);
$this->addColumn('FILE', 'File', 'VARCHAR', true, 255, null);
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 1);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, 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('SelectionContainer', '\\Selection\\Model\\SelectionContainer', RelationMap::MANY_TO_ONE, array('selection_container_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('SelectionContainerImageI18n', '\\Selection\\Model\\SelectionContainerImageI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'SelectionContainerImageI18ns');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
/**
* Method to invalidate the instance pool of all tables related to selection_container_image * 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.
SelectionContainerImageI18nTableMap::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 ? SelectionContainerImageTableMap::CLASS_DEFAULT : SelectionContainerImageTableMap::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 (SelectionContainerImage object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionContainerImageTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionContainerImageTableMap::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 + SelectionContainerImageTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionContainerImageTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionContainerImageTableMap::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 = SelectionContainerImageTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionContainerImageTableMap::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;
SelectionContainerImageTableMap::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(SelectionContainerImageTableMap::ID);
$criteria->addSelectColumn(SelectionContainerImageTableMap::SELECTION_CONTAINER_ID);
$criteria->addSelectColumn(SelectionContainerImageTableMap::FILE);
$criteria->addSelectColumn(SelectionContainerImageTableMap::VISIBLE);
$criteria->addSelectColumn(SelectionContainerImageTableMap::POSITION);
$criteria->addSelectColumn(SelectionContainerImageTableMap::CREATED_AT);
$criteria->addSelectColumn(SelectionContainerImageTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.SELECTION_CONTAINER_ID');
$criteria->addSelectColumn($alias . '.FILE');
$criteria->addSelectColumn($alias . '.VISIBLE');
$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(SelectionContainerImageTableMap::DATABASE_NAME)->getTable(SelectionContainerImageTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionContainerImageTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionContainerImageTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionContainerImageTableMap());
}
}
/**
* Performs a DELETE on the database, given a SelectionContainerImage or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SelectionContainerImage 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(SelectionContainerImageTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\SelectionContainerImage) { // 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(SelectionContainerImageTableMap::DATABASE_NAME);
$criteria->add(SelectionContainerImageTableMap::ID, (array) $values, Criteria::IN);
}
$query = SelectionContainerImageQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionContainerImageTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionContainerImageTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection_container_image 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 SelectionContainerImageQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SelectionContainerImage or Criteria object.
*
* @param mixed $criteria Criteria or SelectionContainerImage 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(SelectionContainerImageTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SelectionContainerImage object
}
// Set the correct dbName
$query = SelectionContainerImageQuery::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;
}
} // SelectionContainerImageTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionContainerImageTableMap::buildTableMap();

View File

@@ -0,0 +1,467 @@
<?php
namespace Selection\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 Selection\Model\SelectionContainer;
use Selection\Model\SelectionContainerQuery;
/**
* This class defines the structure of the 'selection_container' 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 SelectionContainerTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionContainerTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection_container';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\SelectionContainer';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.SelectionContainer';
/**
* The total number of columns
*/
const NUM_COLUMNS = 5;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the ID field
*/
const ID = 'selection_container.ID';
/**
* the column name for the VISIBLE field
*/
const VISIBLE = 'selection_container.VISIBLE';
/**
* the column name for the POSITION field
*/
const POSITION = 'selection_container.POSITION';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'selection_container.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'selection_container.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', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'visible', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(SelectionContainerTableMap::ID, SelectionContainerTableMap::VISIBLE, SelectionContainerTableMap::POSITION, SelectionContainerTableMap::CREATED_AT, SelectionContainerTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'visible', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Visible' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(SelectionContainerTableMap::ID => 0, SelectionContainerTableMap::VISIBLE => 1, SelectionContainerTableMap::POSITION => 2, SelectionContainerTableMap::CREATED_AT => 3, SelectionContainerTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
* 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('selection_container');
$this->setPhpName('SelectionContainer');
$this->setClassName('\\Selection\\Model\\SelectionContainer');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, 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('SelectionContainerAssociatedSelection', '\\Selection\\Model\\SelectionContainerAssociatedSelection', RelationMap::ONE_TO_MANY, array('id' => 'selection_container_id', ), 'CASCADE', 'RESTRICT', 'SelectionContainerAssociatedSelections');
$this->addRelation('SelectionContainerImage', '\\Selection\\Model\\SelectionContainerImage', RelationMap::ONE_TO_MANY, array('id' => 'selection_container_id', ), 'CASCADE', 'RESTRICT', 'SelectionContainerImages');
$this->addRelation('SelectionContainerI18n', '\\Selection\\Model\\SelectionContainerI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'SelectionContainerI18ns');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
/**
* Method to invalidate the instance pool of all tables related to selection_container * 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.
SelectionContainerAssociatedSelectionTableMap::clearInstancePool();
SelectionContainerImageTableMap::clearInstancePool();
SelectionContainerI18nTableMap::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 ? SelectionContainerTableMap::CLASS_DEFAULT : SelectionContainerTableMap::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 (SelectionContainer object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionContainerTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionContainerTableMap::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 + SelectionContainerTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionContainerTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionContainerTableMap::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 = SelectionContainerTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionContainerTableMap::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;
SelectionContainerTableMap::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(SelectionContainerTableMap::ID);
$criteria->addSelectColumn(SelectionContainerTableMap::VISIBLE);
$criteria->addSelectColumn(SelectionContainerTableMap::POSITION);
$criteria->addSelectColumn(SelectionContainerTableMap::CREATED_AT);
$criteria->addSelectColumn(SelectionContainerTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the 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(SelectionContainerTableMap::DATABASE_NAME)->getTable(SelectionContainerTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionContainerTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionContainerTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionContainerTableMap());
}
}
/**
* Performs a DELETE on the database, given a SelectionContainer or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SelectionContainer 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(SelectionContainerTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\SelectionContainer) { // 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(SelectionContainerTableMap::DATABASE_NAME);
$criteria->add(SelectionContainerTableMap::ID, (array) $values, Criteria::IN);
}
$query = SelectionContainerQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionContainerTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionContainerTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection_container 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 SelectionContainerQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SelectionContainer or Criteria object.
*
* @param mixed $criteria Criteria or SelectionContainer 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(SelectionContainerTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SelectionContainer object
}
// Set the correct dbName
$query = SelectionContainerQuery::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;
}
} // SelectionContainerTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionContainerTableMap::buildTableMap();

View File

@@ -0,0 +1,504 @@
<?php
namespace Selection\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 Selection\Model\SelectionContent;
use Selection\Model\SelectionContentQuery;
/**
* This class defines the structure of the 'selection_content' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
*/
class SelectionContentTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionContentTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection_content';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\SelectionContent';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.SelectionContent';
/**
* The total number of columns
*/
const NUM_COLUMNS = 5;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the SELECTION_ID field
*/
const SELECTION_ID = 'selection_content.SELECTION_ID';
/**
* the column name for the CONTENT_ID field
*/
const CONTENT_ID = 'selection_content.CONTENT_ID';
/**
* the column name for the POSITION field
*/
const POSITION = 'selection_content.POSITION';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'selection_content.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'selection_content.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('SelectionId', 'ContentId', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('selectionId', 'contentId', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(SelectionContentTableMap::SELECTION_ID, SelectionContentTableMap::CONTENT_ID, SelectionContentTableMap::POSITION, SelectionContentTableMap::CREATED_AT, SelectionContentTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('SELECTION_ID', 'CONTENT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('selection_id', 'content_id', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('SelectionId' => 0, 'ContentId' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('selectionId' => 0, 'contentId' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(SelectionContentTableMap::SELECTION_ID => 0, SelectionContentTableMap::CONTENT_ID => 1, SelectionContentTableMap::POSITION => 2, SelectionContentTableMap::CREATED_AT => 3, SelectionContentTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('SELECTION_ID' => 0, 'CONTENT_ID' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('selection_id' => 0, 'content_id' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
* 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('selection_content');
$this->setPhpName('SelectionContent');
$this->setClassName('\\Selection\\Model\\SelectionContent');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('SELECTION_ID', 'SelectionId', 'INTEGER' , 'selection', 'ID', true, null, null);
$this->addForeignPrimaryKey('CONTENT_ID', 'ContentId', 'INTEGER' , 'content', 'ID', true, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, 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('Content', '\\Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Selection', '\\Selection\\Model\\Selection', RelationMap::MANY_TO_ONE, array('selection_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* 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 \Selection\Model\SelectionContent $obj A \Selection\Model\SelectionContent 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->getSelectionId(), (string) $obj->getContentId()));
} // 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 \Selection\Model\SelectionContent object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Selection\Model\SelectionContent) {
$key = serialize(array((string) $value->getSelectionId(), (string) $value->getContentId()));
} 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 \Selection\Model\SelectionContent 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('SelectionId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ContentId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('SelectionId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ContentId', 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 ? SelectionContentTableMap::CLASS_DEFAULT : SelectionContentTableMap::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 (SelectionContent object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionContentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionContentTableMap::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 + SelectionContentTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionContentTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionContentTableMap::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 = SelectionContentTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionContentTableMap::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;
SelectionContentTableMap::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(SelectionContentTableMap::SELECTION_ID);
$criteria->addSelectColumn(SelectionContentTableMap::CONTENT_ID);
$criteria->addSelectColumn(SelectionContentTableMap::POSITION);
$criteria->addSelectColumn(SelectionContentTableMap::CREATED_AT);
$criteria->addSelectColumn(SelectionContentTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.SELECTION_ID');
$criteria->addSelectColumn($alias . '.CONTENT_ID');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the TableMap related to this object.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getServiceContainer()->getDatabaseMap(SelectionContentTableMap::DATABASE_NAME)->getTable(SelectionContentTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionContentTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionContentTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionContentTableMap());
}
}
/**
* Performs a DELETE on the database, given a SelectionContent or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SelectionContent 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(SelectionContentTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\SelectionContent) { // 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(SelectionContentTableMap::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(SelectionContentTableMap::SELECTION_ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(SelectionContentTableMap::CONTENT_ID, $value[1]));
$criteria->addOr($criterion);
}
}
$query = SelectionContentQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionContentTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionContentTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection_content table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll(ConnectionInterface $con = null)
{
return SelectionContentQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SelectionContent or Criteria object.
*
* @param mixed $criteria Criteria or SelectionContent 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(SelectionContentTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SelectionContent object
}
// Set the correct dbName
$query = SelectionContentQuery::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;
}
} // SelectionContentTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionContentTableMap::buildTableMap();

View File

@@ -0,0 +1,522 @@
<?php
namespace Selection\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 Selection\Model\SelectionI18n;
use Selection\Model\SelectionI18nQuery;
/**
* This class defines the structure of the 'selection_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 SelectionI18nTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionI18nTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection_i18n';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\SelectionI18n';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.SelectionI18n';
/**
* The total number of columns
*/
const NUM_COLUMNS = 9;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 9;
/**
* the column name for the ID field
*/
const ID = 'selection_i18n.ID';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'selection_i18n.LOCALE';
/**
* the column name for the TITLE field
*/
const TITLE = 'selection_i18n.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'selection_i18n.DESCRIPTION';
/**
* the column name for the CHAPO field
*/
const CHAPO = 'selection_i18n.CHAPO';
/**
* the column name for the POSTSCRIPTUM field
*/
const POSTSCRIPTUM = 'selection_i18n.POSTSCRIPTUM';
/**
* the column name for the META_TITLE field
*/
const META_TITLE = 'selection_i18n.META_TITLE';
/**
* the column name for the META_DESCRIPTION field
*/
const META_DESCRIPTION = 'selection_i18n.META_DESCRIPTION';
/**
* the column name for the META_KEYWORDS field
*/
const META_KEYWORDS = 'selection_i18n.META_KEYWORDS';
/**
* 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', 'Chapo', 'Postscriptum', 'MetaTitle', 'MetaDescription', 'MetaKeywords', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'metaTitle', 'metaDescription', 'metaKeywords', ),
self::TYPE_COLNAME => array(SelectionI18nTableMap::ID, SelectionI18nTableMap::LOCALE, SelectionI18nTableMap::TITLE, SelectionI18nTableMap::DESCRIPTION, SelectionI18nTableMap::CHAPO, SelectionI18nTableMap::POSTSCRIPTUM, SelectionI18nTableMap::META_TITLE, SelectionI18nTableMap::META_DESCRIPTION, SelectionI18nTableMap::META_KEYWORDS, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS', ),
self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'meta_title', 'meta_description', 'meta_keywords', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, 'MetaTitle' => 6, 'MetaDescription' => 7, 'MetaKeywords' => 8, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'metaTitle' => 6, 'metaDescription' => 7, 'metaKeywords' => 8, ),
self::TYPE_COLNAME => array(SelectionI18nTableMap::ID => 0, SelectionI18nTableMap::LOCALE => 1, SelectionI18nTableMap::TITLE => 2, SelectionI18nTableMap::DESCRIPTION => 3, SelectionI18nTableMap::CHAPO => 4, SelectionI18nTableMap::POSTSCRIPTUM => 5, SelectionI18nTableMap::META_TITLE => 6, SelectionI18nTableMap::META_DESCRIPTION => 7, SelectionI18nTableMap::META_KEYWORDS => 8, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, 'META_TITLE' => 6, 'META_DESCRIPTION' => 7, 'META_KEYWORDS' => 8, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'meta_title' => 6, 'meta_description' => 7, 'meta_keywords' => 8, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* 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('selection_i18n');
$this->setPhpName('SelectionI18n');
$this->setClassName('\\Selection\\Model\\SelectionI18n');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'selection', 'ID', true, null, null);
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
$this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_TITLE', 'MetaTitle', 'VARCHAR', false, 255, null);
$this->addColumn('META_DESCRIPTION', 'MetaDescription', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_KEYWORDS', 'MetaKeywords', 'LONGVARCHAR', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('Selection', '\\Selection\\Model\\Selection', 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 \Selection\Model\SelectionI18n $obj A \Selection\Model\SelectionI18n 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 \Selection\Model\SelectionI18n object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Selection\Model\SelectionI18n) {
$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 \Selection\Model\SelectionI18n 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 ? SelectionI18nTableMap::CLASS_DEFAULT : SelectionI18nTableMap::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 (SelectionI18n object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionI18nTableMap::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 + SelectionI18nTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionI18nTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionI18nTableMap::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 = SelectionI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionI18nTableMap::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;
SelectionI18nTableMap::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(SelectionI18nTableMap::ID);
$criteria->addSelectColumn(SelectionI18nTableMap::LOCALE);
$criteria->addSelectColumn(SelectionI18nTableMap::TITLE);
$criteria->addSelectColumn(SelectionI18nTableMap::DESCRIPTION);
$criteria->addSelectColumn(SelectionI18nTableMap::CHAPO);
$criteria->addSelectColumn(SelectionI18nTableMap::POSTSCRIPTUM);
$criteria->addSelectColumn(SelectionI18nTableMap::META_TITLE);
$criteria->addSelectColumn(SelectionI18nTableMap::META_DESCRIPTION);
$criteria->addSelectColumn(SelectionI18nTableMap::META_KEYWORDS);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.CHAPO');
$criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
$criteria->addSelectColumn($alias . '.META_TITLE');
$criteria->addSelectColumn($alias . '.META_DESCRIPTION');
$criteria->addSelectColumn($alias . '.META_KEYWORDS');
}
}
/**
* 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(SelectionI18nTableMap::DATABASE_NAME)->getTable(SelectionI18nTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionI18nTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionI18nTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionI18nTableMap());
}
}
/**
* Performs a DELETE on the database, given a SelectionI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SelectionI18n 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(SelectionI18nTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\SelectionI18n) { // 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(SelectionI18nTableMap::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(SelectionI18nTableMap::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(SelectionI18nTableMap::LOCALE, $value[1]));
$criteria->addOr($criterion);
}
}
$query = SelectionI18nQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionI18nTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionI18nTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection_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 SelectionI18nQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SelectionI18n or Criteria object.
*
* @param mixed $criteria Criteria or SelectionI18n 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(SelectionI18nTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SelectionI18n object
}
// Set the correct dbName
$query = SelectionI18nQuery::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;
}
} // SelectionI18nTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionI18nTableMap::buildTableMap();

View File

@@ -0,0 +1,498 @@
<?php
namespace Selection\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 Selection\Model\SelectionImageI18n;
use Selection\Model\SelectionImageI18nQuery;
/**
* This class defines the structure of the 'selection_image_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 SelectionImageI18nTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionImageI18nTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection_image_i18n';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\SelectionImageI18n';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.SelectionImageI18n';
/**
* The total number of columns
*/
const NUM_COLUMNS = 6;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 6;
/**
* the column name for the ID field
*/
const ID = 'selection_image_i18n.ID';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'selection_image_i18n.LOCALE';
/**
* the column name for the TITLE field
*/
const TITLE = 'selection_image_i18n.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'selection_image_i18n.DESCRIPTION';
/**
* the column name for the CHAPO field
*/
const CHAPO = 'selection_image_i18n.CHAPO';
/**
* the column name for the POSTSCRIPTUM field
*/
const POSTSCRIPTUM = 'selection_image_i18n.POSTSCRIPTUM';
/**
* 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', 'Chapo', 'Postscriptum', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
self::TYPE_COLNAME => array(SelectionImageI18nTableMap::ID, SelectionImageI18nTableMap::LOCALE, SelectionImageI18nTableMap::TITLE, SelectionImageI18nTableMap::DESCRIPTION, SelectionImageI18nTableMap::CHAPO, SelectionImageI18nTableMap::POSTSCRIPTUM, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
self::TYPE_COLNAME => array(SelectionImageI18nTableMap::ID => 0, SelectionImageI18nTableMap::LOCALE => 1, SelectionImageI18nTableMap::TITLE => 2, SelectionImageI18nTableMap::DESCRIPTION => 3, SelectionImageI18nTableMap::CHAPO => 4, SelectionImageI18nTableMap::POSTSCRIPTUM => 5, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('selection_image_i18n');
$this->setPhpName('SelectionImageI18n');
$this->setClassName('\\Selection\\Model\\SelectionImageI18n');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'selection_image', 'ID', true, null, null);
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
$this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('SelectionImage', '\\Selection\\Model\\SelectionImage', 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 \Selection\Model\SelectionImageI18n $obj A \Selection\Model\SelectionImageI18n 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 \Selection\Model\SelectionImageI18n object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Selection\Model\SelectionImageI18n) {
$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 \Selection\Model\SelectionImageI18n 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 ? SelectionImageI18nTableMap::CLASS_DEFAULT : SelectionImageI18nTableMap::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 (SelectionImageI18n object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionImageI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionImageI18nTableMap::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 + SelectionImageI18nTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionImageI18nTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionImageI18nTableMap::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 = SelectionImageI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionImageI18nTableMap::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;
SelectionImageI18nTableMap::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(SelectionImageI18nTableMap::ID);
$criteria->addSelectColumn(SelectionImageI18nTableMap::LOCALE);
$criteria->addSelectColumn(SelectionImageI18nTableMap::TITLE);
$criteria->addSelectColumn(SelectionImageI18nTableMap::DESCRIPTION);
$criteria->addSelectColumn(SelectionImageI18nTableMap::CHAPO);
$criteria->addSelectColumn(SelectionImageI18nTableMap::POSTSCRIPTUM);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.CHAPO');
$criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
}
}
/**
* 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(SelectionImageI18nTableMap::DATABASE_NAME)->getTable(SelectionImageI18nTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionImageI18nTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionImageI18nTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionImageI18nTableMap());
}
}
/**
* Performs a DELETE on the database, given a SelectionImageI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SelectionImageI18n 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(SelectionImageI18nTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\SelectionImageI18n) { // 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(SelectionImageI18nTableMap::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(SelectionImageI18nTableMap::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(SelectionImageI18nTableMap::LOCALE, $value[1]));
$criteria->addOr($criterion);
}
}
$query = SelectionImageI18nQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionImageI18nTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionImageI18nTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection_image_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 SelectionImageI18nQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SelectionImageI18n or Criteria object.
*
* @param mixed $criteria Criteria or SelectionImageI18n 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(SelectionImageI18nTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SelectionImageI18n object
}
// Set the correct dbName
$query = SelectionImageI18nQuery::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;
}
} // SelectionImageI18nTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionImageI18nTableMap::buildTableMap();

View File

@@ -0,0 +1,484 @@
<?php
namespace Selection\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 Selection\Model\SelectionImage;
use Selection\Model\SelectionImageQuery;
/**
* This class defines the structure of the 'selection_image' 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 SelectionImageTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionImageTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection_image';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\SelectionImage';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.SelectionImage';
/**
* The total number of columns
*/
const NUM_COLUMNS = 7;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 7;
/**
* the column name for the ID field
*/
const ID = 'selection_image.ID';
/**
* the column name for the SELECTION_ID field
*/
const SELECTION_ID = 'selection_image.SELECTION_ID';
/**
* the column name for the FILE field
*/
const FILE = 'selection_image.FILE';
/**
* the column name for the VISIBLE field
*/
const VISIBLE = 'selection_image.VISIBLE';
/**
* the column name for the POSITION field
*/
const POSITION = 'selection_image.POSITION';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'selection_image.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'selection_image.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', 'SelectionId', 'File', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'selectionId', 'file', 'visible', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(SelectionImageTableMap::ID, SelectionImageTableMap::SELECTION_ID, SelectionImageTableMap::FILE, SelectionImageTableMap::VISIBLE, SelectionImageTableMap::POSITION, SelectionImageTableMap::CREATED_AT, SelectionImageTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'SELECTION_ID', 'FILE', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'selection_id', 'file', 'visible', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'SelectionId' => 1, 'File' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'selectionId' => 1, 'file' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
self::TYPE_COLNAME => array(SelectionImageTableMap::ID => 0, SelectionImageTableMap::SELECTION_ID => 1, SelectionImageTableMap::FILE => 2, SelectionImageTableMap::VISIBLE => 3, SelectionImageTableMap::POSITION => 4, SelectionImageTableMap::CREATED_AT => 5, SelectionImageTableMap::UPDATED_AT => 6, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'SELECTION_ID' => 1, 'FILE' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
self::TYPE_FIELDNAME => array('id' => 0, 'selection_id' => 1, 'file' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
* 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('selection_image');
$this->setPhpName('SelectionImage');
$this->setClassName('\\Selection\\Model\\SelectionImage');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('SELECTION_ID', 'SelectionId', 'INTEGER', 'selection', 'ID', true, null, null);
$this->addColumn('FILE', 'File', 'VARCHAR', true, 255, null);
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 1);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, 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('Selection', '\\Selection\\Model\\Selection', RelationMap::MANY_TO_ONE, array('selection_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('SelectionImageI18n', '\\Selection\\Model\\SelectionImageI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'SelectionImageI18ns');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
/**
* Method to invalidate the instance pool of all tables related to selection_image * 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.
SelectionImageI18nTableMap::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 ? SelectionImageTableMap::CLASS_DEFAULT : SelectionImageTableMap::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 (SelectionImage object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionImageTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionImageTableMap::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 + SelectionImageTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionImageTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionImageTableMap::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 = SelectionImageTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionImageTableMap::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;
SelectionImageTableMap::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(SelectionImageTableMap::ID);
$criteria->addSelectColumn(SelectionImageTableMap::SELECTION_ID);
$criteria->addSelectColumn(SelectionImageTableMap::FILE);
$criteria->addSelectColumn(SelectionImageTableMap::VISIBLE);
$criteria->addSelectColumn(SelectionImageTableMap::POSITION);
$criteria->addSelectColumn(SelectionImageTableMap::CREATED_AT);
$criteria->addSelectColumn(SelectionImageTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.SELECTION_ID');
$criteria->addSelectColumn($alias . '.FILE');
$criteria->addSelectColumn($alias . '.VISIBLE');
$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(SelectionImageTableMap::DATABASE_NAME)->getTable(SelectionImageTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionImageTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionImageTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionImageTableMap());
}
}
/**
* Performs a DELETE on the database, given a SelectionImage or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SelectionImage 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(SelectionImageTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\SelectionImage) { // 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(SelectionImageTableMap::DATABASE_NAME);
$criteria->add(SelectionImageTableMap::ID, (array) $values, Criteria::IN);
}
$query = SelectionImageQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionImageTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionImageTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection_image 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 SelectionImageQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SelectionImage or Criteria object.
*
* @param mixed $criteria Criteria or SelectionImage 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(SelectionImageTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SelectionImage object
}
if ($criteria->containsKey(SelectionImageTableMap::ID) && $criteria->keyContainsValue(SelectionImageTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.SelectionImageTableMap::ID.')');
}
// Set the correct dbName
$query = SelectionImageQuery::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;
}
} // SelectionImageTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionImageTableMap::buildTableMap();

View File

@@ -0,0 +1,504 @@
<?php
namespace Selection\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 Selection\Model\SelectionProduct;
use Selection\Model\SelectionProductQuery;
/**
* This class defines the structure of the 'selection_product' 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 SelectionProductTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionProductTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection_product';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\SelectionProduct';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.SelectionProduct';
/**
* The total number of columns
*/
const NUM_COLUMNS = 5;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the SELECTION_ID field
*/
const SELECTION_ID = 'selection_product.SELECTION_ID';
/**
* the column name for the PRODUCT_ID field
*/
const PRODUCT_ID = 'selection_product.PRODUCT_ID';
/**
* the column name for the POSITION field
*/
const POSITION = 'selection_product.POSITION';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'selection_product.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'selection_product.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('SelectionId', 'ProductId', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('selectionId', 'productId', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(SelectionProductTableMap::SELECTION_ID, SelectionProductTableMap::PRODUCT_ID, SelectionProductTableMap::POSITION, SelectionProductTableMap::CREATED_AT, SelectionProductTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('SELECTION_ID', 'PRODUCT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('selection_id', 'product_id', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('SelectionId' => 0, 'ProductId' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('selectionId' => 0, 'productId' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(SelectionProductTableMap::SELECTION_ID => 0, SelectionProductTableMap::PRODUCT_ID => 1, SelectionProductTableMap::POSITION => 2, SelectionProductTableMap::CREATED_AT => 3, SelectionProductTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('SELECTION_ID' => 0, 'PRODUCT_ID' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('selection_id' => 0, 'product_id' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
* 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('selection_product');
$this->setPhpName('SelectionProduct');
$this->setClassName('\\Selection\\Model\\SelectionProduct');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('SELECTION_ID', 'SelectionId', 'INTEGER' , 'selection', 'ID', true, null, null);
$this->addForeignPrimaryKey('PRODUCT_ID', 'ProductId', 'INTEGER' , 'product', 'ID', true, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Selection', '\\Selection\\Model\\Selection', RelationMap::MANY_TO_ONE, array('selection_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* 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 \Selection\Model\SelectionProduct $obj A \Selection\Model\SelectionProduct 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->getSelectionId(), (string) $obj->getProductId()));
} // 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 \Selection\Model\SelectionProduct object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Selection\Model\SelectionProduct) {
$key = serialize(array((string) $value->getSelectionId(), (string) $value->getProductId()));
} 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 \Selection\Model\SelectionProduct 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('SelectionId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('SelectionId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', 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 ? SelectionProductTableMap::CLASS_DEFAULT : SelectionProductTableMap::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 (SelectionProduct object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionProductTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionProductTableMap::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 + SelectionProductTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionProductTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionProductTableMap::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 = SelectionProductTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionProductTableMap::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;
SelectionProductTableMap::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(SelectionProductTableMap::SELECTION_ID);
$criteria->addSelectColumn(SelectionProductTableMap::PRODUCT_ID);
$criteria->addSelectColumn(SelectionProductTableMap::POSITION);
$criteria->addSelectColumn(SelectionProductTableMap::CREATED_AT);
$criteria->addSelectColumn(SelectionProductTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.SELECTION_ID');
$criteria->addSelectColumn($alias . '.PRODUCT_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(SelectionProductTableMap::DATABASE_NAME)->getTable(SelectionProductTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionProductTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionProductTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionProductTableMap());
}
}
/**
* Performs a DELETE on the database, given a SelectionProduct or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or SelectionProduct 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(SelectionProductTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\SelectionProduct) { // 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(SelectionProductTableMap::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(SelectionProductTableMap::SELECTION_ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(SelectionProductTableMap::PRODUCT_ID, $value[1]));
$criteria->addOr($criterion);
}
}
$query = SelectionProductQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionProductTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionProductTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection_product 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 SelectionProductQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a SelectionProduct or Criteria object.
*
* @param mixed $criteria Criteria or SelectionProduct 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(SelectionProductTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from SelectionProduct object
}
// Set the correct dbName
$query = SelectionProductQuery::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;
}
} // SelectionProductTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionProductTableMap::buildTableMap();

View File

@@ -0,0 +1,475 @@
<?php
namespace Selection\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 Selection\Model\Selection;
use Selection\Model\SelectionQuery;
/**
* This class defines the structure of the 'selection' 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 SelectionTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Selection.Model.Map.SelectionTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'selection';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Selection\\Model\\Selection';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Selection.Model.Selection';
/**
* The total number of columns
*/
const NUM_COLUMNS = 5;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the ID field
*/
const ID = 'selection.ID';
/**
* the column name for the VISIBLE field
*/
const VISIBLE = 'selection.VISIBLE';
/**
* the column name for the POSITION field
*/
const POSITION = 'selection.POSITION';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'selection.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'selection.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', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'visible', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(SelectionTableMap::ID, SelectionTableMap::VISIBLE, SelectionTableMap::POSITION, SelectionTableMap::CREATED_AT, SelectionTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'visible', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Visible' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(SelectionTableMap::ID => 0, SelectionTableMap::VISIBLE => 1, SelectionTableMap::POSITION => 2, SelectionTableMap::CREATED_AT => 3, SelectionTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
* 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('selection');
$this->setPhpName('Selection');
$this->setClassName('\\Selection\\Model\\Selection');
$this->setPackage('Selection.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, 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('SelectionProduct', '\\Selection\\Model\\SelectionProduct', RelationMap::ONE_TO_MANY, array('id' => 'selection_id', ), 'CASCADE', 'RESTRICT', 'SelectionProducts');
$this->addRelation('SelectionContent', '\\Selection\\Model\\SelectionContent', RelationMap::ONE_TO_MANY, array('id' => 'selection_id', ), 'CASCADE', 'RESTRICT', 'SelectionContents');
$this->addRelation('SelectionImage', '\\Selection\\Model\\SelectionImage', RelationMap::ONE_TO_MANY, array('id' => 'selection_id', ), 'CASCADE', 'RESTRICT', 'SelectionImages');
$this->addRelation('SelectionContainerAssociatedSelection', '\\Selection\\Model\\SelectionContainerAssociatedSelection', RelationMap::ONE_TO_MANY, array('id' => 'selection_id', ), 'CASCADE', 'RESTRICT', 'SelectionContainerAssociatedSelections');
$this->addRelation('SelectionI18n', '\\Selection\\Model\\SelectionI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'SelectionI18ns');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
/**
* Method to invalidate the instance pool of all tables related to selection * 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.
SelectionProductTableMap::clearInstancePool();
SelectionContentTableMap::clearInstancePool();
SelectionImageTableMap::clearInstancePool();
SelectionContainerAssociatedSelectionTableMap::clearInstancePool();
SelectionI18nTableMap::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 ? SelectionTableMap::CLASS_DEFAULT : SelectionTableMap::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 (Selection object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = SelectionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = SelectionTableMap::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 + SelectionTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = SelectionTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
SelectionTableMap::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 = SelectionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = SelectionTableMap::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;
SelectionTableMap::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(SelectionTableMap::ID);
$criteria->addSelectColumn(SelectionTableMap::VISIBLE);
$criteria->addSelectColumn(SelectionTableMap::POSITION);
$criteria->addSelectColumn(SelectionTableMap::CREATED_AT);
$criteria->addSelectColumn(SelectionTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
/**
* Returns the 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(SelectionTableMap::DATABASE_NAME)->getTable(SelectionTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(SelectionTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(SelectionTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new SelectionTableMap());
}
}
/**
* Performs a DELETE on the database, given a Selection or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Selection 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(SelectionTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Selection\Model\Selection) { // 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(SelectionTableMap::DATABASE_NAME);
$criteria->add(SelectionTableMap::ID, (array) $values, Criteria::IN);
}
$query = SelectionQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { SelectionTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { SelectionTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the selection 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 SelectionQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a Selection or Criteria object.
*
* @param mixed $criteria Criteria or Selection 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(SelectionTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from Selection object
}
if ($criteria->containsKey(SelectionTableMap::ID) && $criteria->keyContainsValue(SelectionTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.SelectionTableMap::ID.')');
}
// Set the correct dbName
$query = SelectionQuery::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;
}
} // SelectionTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
SelectionTableMap::buildTableMap();

View File

@@ -0,0 +1,80 @@
<?php
namespace Selection\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Selection\Event\SelectionEvent;
use Selection\Event\SelectionEvents;
use Selection\Model\Base\Selection as BaseSelection;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Model\Tools\UrlRewritingTrait;
use Thelia\Model\Tools\PositionManagementTrait;
class Selection extends BaseSelection
{
use UrlRewritingTrait;
use ModelEventDispatcherTrait;
use PositionManagementTrait;
public function getRewrittenUrlViewName()
{
return 'selection';
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
// Set the current position for the new object
$this->setPosition($this->getNextPosition());
$this->dispatchEvent(SelectionEvents::BEFORE_CREATE_SELECTION, new SelectionEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(SelectionEvents::AFTER_CREATE_SELECTION, new SelectionEvent($this));
}
/**
* {@inheritDoc}
*/
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(SelectionEvents::BEFORE_UPDATE_SELECTION, new SelectionEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(SelectionEvents::AFTER_UPDATE_SELECTION, new SelectionEvent($this));
}
/**
* {@inheritDoc}
*/
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(SelectionEvents::BEFORE_DELETE_SELECTION, new SelectionEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(SelectionEvents::AFTER_DELETE_SELECTION, new SelectionEvent($this));
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace Selection\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Selection\Event\SelectionContainerEvent;
use Selection\Event\SelectionEvents;
use Selection\Model\Base\SelectionContainer as BaseSelectionContainer;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Model\Tools\PositionManagementTrait;
use Thelia\Model\Tools\UrlRewritingTrait;
class SelectionContainer extends BaseSelectionContainer
{
use UrlRewritingTrait;
use ModelEventDispatcherTrait;
use PositionManagementTrait;
const IMAGE_TYPE_LABEL = 'SelectionContainer';
public function getRewrittenUrlViewName()
{
return 'selection_container';
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
// Set the current position for the new object
$this->setPosition($this->getNextPosition());
$this->dispatchEvent(SelectionEvents::BEFORE_CREATE_SELECTION_CONTAINER, new SelectionContainerEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(SelectionEvents::AFTER_CREATE_SELECTION_CONTAINER, new SelectionContainerEvent($this));
}
/**
* {@inheritDoc}
*/
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(SelectionEvents::BEFORE_UPDATE_SELECTION_CONTAINER, new SelectionContainerEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(SelectionEvents::AFTER_UPDATE_SELECTION_CONTAINER, new SelectionContainerEvent($this));
}
/**
* {@inheritDoc}
*/
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(SelectionEvents::BEFORE_DELETE_SELECTION_CONTAINER, new SelectionContainerEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(SelectionEvents::AFTER_DELETE_SELECTION_CONTAINER, new SelectionContainerEvent($this));
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Selection\Model;
use Selection\Model\Base\SelectionContainerAssociatedSelection as BaseSelectionContainerAssociatedSelection;
class SelectionContainerAssociatedSelection extends BaseSelectionContainerAssociatedSelection
{
}

View File

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

View File

@@ -0,0 +1,10 @@
<?php
namespace Selection\Model;
use Selection\Model\Base\SelectionContainerI18n as BaseSelectionContainerI18n;
class SelectionContainerI18n extends BaseSelectionContainerI18n
{
}

View File

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

View File

@@ -0,0 +1,121 @@
<?php
namespace Selection\Model;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Connection\ConnectionInterface;
use Selection\Model\Base\SelectionContainerImage as BaseSelectionContainerImage;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Files\FileModelInterface;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Model\Breadcrumb\CatalogBreadcrumbTrait;
use Thelia\Model\ConfigQuery;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Model\Tools\PositionManagementTrait;
class SelectionContainerImage extends BaseSelectionContainerImage implements FileModelInterface, BreadcrumbInterface
{
use CatalogBreadcrumbTrait;
use PositionManagementTrait;
use ModelEventDispatcherTrait;
protected function addCriteriaToPositionQuery($query)
{
$query->filterById($this->getId());
}
/**
* @inheritDoc
*/
public function preInsert(ConnectionInterface $con = null)
{
$lastImage = SelectionImageQuery::create()
->filterBySelectionId(
$this->getSelectionContainerId()
)
->orderByPosition(Criteria::DESC)
->findOne();
if (null !== $lastImage) {
$position = $lastImage->getPosition() + 1;
} else {
$position = 1;
}
$this->setPosition($position);
return true;
}
public function setParentId($parentId)
{
$this->setSelectionContainerId($parentId);
return $this;
}
public function getUpdateFormId()
{
return 'admin.selection.image.modification';
}
public function getUploadDir()
{
$uploadDir = ConfigQuery::read('images_library_path');
if ($uploadDir === null) {
$uploadDir = THELIA_LOCAL_DIR . 'media' . DS . 'images';
} else {
$uploadDir = THELIA_ROOT . $uploadDir;
}
return $uploadDir . DS . strtolower(SelectionContainer::IMAGE_TYPE_LABEL);
}
public function getRedirectionUrl()
{
return '/admin/selection/container/update/' . $this->getSelectionContainerId();
}
public function getParentId()
{
return $this->getId();
}
public function getParentFileModel()
{
return new SelectionContainer();
}
public function getQueryInstance()
{
return SelectionContainerImageQuery::create();
}
/**
* @param Router $router
* @param ContainerInterface $container
* @param string $tab
* @param string $locale
* @return array|mixed
* @throws \Propel\Runtime\Exception\PropelException
*/
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
/** @var SelectionContainerImage $selectionContainer */
$selectionContainer = $this->getSelectionContainer();
$selectionContainer->setLocale($locale);
$breadcrumb[$selectionContainer->getTitle()] = sprintf(
"%s?current_tab=%s",
$router->generate(
'admin.selection.container.view',
['selectionContainerId' => $selectionContainer->getId()],
Router::ABSOLUTE_URL
),
$tab
);
return $breadcrumb;
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Selection\Model;
use Selection\Model\Base\SelectionContainerImageI18n as BaseSelectionContainerImageI18n;
class SelectionContainerImageI18n extends BaseSelectionContainerImageI18n
{
}

View File

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

View File

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

View File

@@ -0,0 +1,52 @@
<?php
namespace Selection\Model;
use Selection\Model\Base\SelectionContainerQuery as BaseSelectionContainerQuery;
use Thelia\Log\Tlog;
use Thelia\Model\Lang;
use Thelia\Model\Tools\ModelCriteriaTools;
/**
* Skeleton subclass for performing query and update operations on the 'selection_container' 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 SelectionContainerQuery extends BaseSelectionContainerQuery
{
/**
* @param $lang Lang
* @return SelectionContainer[]
*/
public static function getAll($lang)
{
try {
$containerQuery = SelectionContainerQuery::create();
/* manage translations */
ModelCriteriaTools::getI18n(
false,
$lang->getId(),
$containerQuery,
$lang->getLocale(),
array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'),
null,
'ID',
false
);
$containers = $containerQuery->find();
if (empty($containers)) {
return [];
}
return $containers;
} catch (\Exception $e) {
Tlog::getInstance()->error($e->getMessage());
}
return [];
}
} // SelectionContainerQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace Selection\Model;
use Selection\Model\Base\SelectionContent as BaseSelectionContent;
class SelectionContent extends BaseSelectionContent
{
}

View File

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

View File

@@ -0,0 +1,10 @@
<?php
namespace Selection\Model;
use Selection\Model\Base\SelectionI18n as BaseSelectionI18n;
class SelectionI18n extends BaseSelectionI18n
{
}

View File

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

View File

@@ -0,0 +1,119 @@
<?php
namespace Selection\Model;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Connection\ConnectionInterface;
use Selection\Model\Base\SelectionImage as BaseSelectionImage;
use Selection\Model\Map\SelectionImageTableMap;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\Translation\Translator;
use Thelia\Files\FileModelInterface;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Model\Breadcrumb\CatalogBreadcrumbTrait;
use Thelia\Model\ConfigQuery;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Model\Tools\PositionManagementTrait;
class SelectionImage extends BaseSelectionImage implements FileModelInterface, BreadcrumbInterface
{
use CatalogBreadcrumbTrait;
use PositionManagementTrait;
use ModelEventDispatcherTrait;
protected function addCriteriaToPositionQuery($query)
{
$query->filterById($this->getId());
}
/**
* @inheritDoc
*/
public function preInsert(ConnectionInterface $con = null)
{
$lastImage = SelectionImageQuery::create()
->filterBySelectionId(
$this->getSelection()
->getId()
)
->orderByPosition(Criteria::DESC)
->findOne();
if (null !== $lastImage) {
$position = $lastImage->getPosition() + 1;
} else {
$position = 1;
}
$this->setPosition($position);
return true;
}
public function setParentId($parentId)
{
$this->setSelectionId($parentId);
return $this;
}
public function getUpdateFormId()
{
return 'admin.selection.image.modification';
}
public function getUploadDir()
{
$uploadDir = ConfigQuery::read('images_library_path');
if ($uploadDir === null) {
$uploadDir = THELIA_LOCAL_DIR . 'media' . DS . 'images';
} else {
$uploadDir = THELIA_ROOT . $uploadDir;
}
return $uploadDir . DS . 'selection';
}
public function getRedirectionUrl()
{
return '/admin/selection/update/' . $this->getId();
}
public function getParentId()
{
return $this->getId();
}
public function getParentFileModel()
{
return new Selection();
}
public function getQueryInstance()
{
return SelectionImageQuery::create();
}
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
$translator = Translator::getInstance();
/** @var SelectionImage $selection */
$selection = $this->getSelection();
$selection->setLocale($locale);
$breadcrumb[$selection->getTitle()] = sprintf(
"%s?current_tab=%s",
$router->generate(
'selection.update',
['selectionId' => $selection->getId()],
Router::ABSOLUTE_URL
),
$tab
);
return $breadcrumb;
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Selection\Model;
use Selection\Model\Base\SelectionImageI18n as BaseSelectionImageI18n;
class SelectionImageI18n extends BaseSelectionImageI18n
{
}

View File

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

View File

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

View File

@@ -0,0 +1,20 @@
<?php
namespace Selection\Model;
use Selection\Model\Base\SelectionProduct as BaseSelectionProduct;
use Thelia\Model\Tools\PositionManagementTrait;
class SelectionProduct extends BaseSelectionProduct
{
use PositionManagementTrait;
/**
* @inheritdoc
*/
protected function addCriteriaToPositionQuery(SelectionProductQuery $query)
{
$query->filterBySelectionId($this->getSelectionId());
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Selection\Model;
use Selection\Model\Base\SelectionProductQuery as BaseSelectionProductQuery;
use Thelia\Model\Tools\PositionManagementTrait;
/**
* Skeleton subclass for performing query and update operations on the 'selection_product' 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 SelectionProductQuery extends BaseSelectionProductQuery
{
use PositionManagementTrait;
} // SelectionProductQuery

View File

@@ -0,0 +1,22 @@
<?php
namespace Selection\Model;
use Selection\Model\Base\SelectionQuery as BaseSelectionQuery;
use Thelia\Model\Tools\PositionManagementTrait;
/**
* Skeleton subclass for performing query and update operations on the 'selection' 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 SelectionQuery extends BaseSelectionQuery
{
use PositionManagementTrait;
} // SelectionQuery

View File

@@ -0,0 +1,166 @@
# Selection
This module allows you to create a selection of products or contents of similar themes
(Best sellers, Best rated by women, .. for example). The selection will then be displayed as list
of those products or contents.
## Compatibility
* To use this module on Thelia 2.3.x, use the tag 1.1.9
## Installation
### Manually
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is Selection.
* Activate it in your thelia administration panel
### Composer
Add it in your main thelia composer.json file
```
composer require thelia/selection-module:~1.1.11
```
## Usage
Once activated, a new button called "Selection" will appear in the tool menu on the left sidebar of the admin panel.
Clicking on it will redirect you to the list of all the selections you've created so far.
Once on the page with all your selections you may :
- Create a new selection by clicking on the + button at the top right of the page.
- Toggle the visibility of your selection (whether people will see it or not) by clicking on the "Online" button in
front of the selection you wish to make visible or invisible.
- Edit an already created selection by clicking on its name or on the cog button then on the pencil button in front
of the selection you wish to edit.
- Delete a selection by clicking on the cog button then on the trash button in front of the selection you wish to delete.
You may then display your selection on your website by calling the selection_list loop.
## Hook
This module has a single hook in the back office, adding the Selection button to the tools menu of the sidebar on
the left, redirecting to the list of selection.
## Loop
[selection_list]
This loop returns a list of selections. You can use it to display the selections you've created in your website.
### Input arguments
|Variable |Description |
|--- |--- |
|**id** | A string containing the IDs of all the selections you wish to display. To get the ID of the current rewritten URL, use : $app->request->get('selection_id') in your template|
|**code** | A string containing one or more codes of the selections you wish to display.|
|**exclude_code** | A string containing one or more codes of the selections you wish to exclude from the loop results.|
|**title** | The title of the selection you wish to display |
|**visible** | Whether your selection will be visible or not. Default : true |
|**position** | The position of the selection you wish to display |
|**exclude** | A string containing the IDs of all the selections you wish not to display |
|**order** | A string with a value inside these values : 'id', 'id_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'created', 'created_reverse', 'updated', 'updated_reverse', 'random'|
|**return_url** | A boolean indicating if we want the url (cf BaseLoop)
|**without_container** | A boolean indicating if we want to display selection that are not inside a container only
|**container_id** | The container id to query only the selections inside that container
### Output arguments
|Variable |Description |
|--- |--- |
|**SELECTION_ID** | The ID of the current Selection |
|**SELECTION_CODE** | The code of the current Selection |
|**SELECTION_TITLE** | The title of the current Selection |
|**SELECTION_DESCRIPTION** | The description of the current Selection |
|**SELECTION_CHAPO** | The chapo of the current Selection |
|**SELECTION_POSTSCRIPTUM** | The postscriptum of the current Selection |
|**SELECTION_VISIBLE** | Whether the current selection is visible or not |
|**SELECTION_POSITION** | The position of the current selection |
|**SELECTION_URL** | The URL of the current selection |
|**SELECTION_CONTAINER_ID** | The id of the container associated to the current Selection |
### Exemple
````
{loop name="selection_list" type="selection_list" visible=true id='1,4'}
This selection id : {$SELECTION_ID}
This selection title : {$SELECTION_TITLE}
This selection code : {$SELECTION_CODE}
This selection status : {$SELECTION_VISIBLE}
This selection description : {$SELECTION_DESCRIPTION}
This selection chapo : {$SELECTION_CHAPO}
This selection url : {$SELECTION_URL}
This selection postscriptum : {$SELECTION_POSTSCRIPTUM}
This selection position : {$SELECTION_POSITION}
{/loop}
````
[selection_image]
This loop returns the images related to a selection.
### Input arguments
Input Arguments are extended by Thelia\Core\Templates\Loop\Image
### Output arguments
Output Arguments are extended by Thelia\Core\Templates\Loop\Image
### Exemple
````
{loop type="selection_image" name="selection_image" source="selection" source_id=$SELECTION_ID limit="1" visible="true"}
{/loop}
````
[selection_container]
This loop returns a list of selections containers. You can use it to display the selections containers you've created in your website.
### Input arguments
|Variable |Description |
|--- |--- |
|**id** | A string containing the IDs of all the selections containers you wish to display. To get the ID of the current rewritten URL, use : $app->request->get('selection_id') in your template|
|**code** | A string containing one or more codes of the selection containers you wish to display.|
|**exclude_code** | A string containing one or more codes of the selection containers you wish to exclude from the loop results.|
|**selection_id** | The selection id to find
|**need_selection_count** | boolean indicating if we want to have the number of selection inside this container
|**title** | The title of the selection you wish to display |
|**visible** | Whether your selection will be visible or not. Default : true |
|**position** | The position of the selection you wish to display |
|**exclude** | A string containing the IDs of all the selections you wish not to display |
|**order** | A string with a value inside these values : 'id', 'id_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'created', 'created_reverse', 'updated', 'updated_reverse', 'random'|
|**return_url** | A boolean indicating if we want the url (cf BaseLoop)
### Output arguments
|Variable |Description |
|--- |--- |
|**SELECTION_CONTAINER_ID** | The ID of the current container |
|**SELECTION_CONTAINER_TITLE** | The title of the current container |
|**SELECTION_CONTAINER_CODE** | The code of the current container |
|**SELECTION_CONTAINER_DESCRIPTION** | The description of the current container |
|**SELECTION_CONTAINER_CHAPO** | The chapo of the current container |
|**SELECTION_CONTAINER_POSTSCRIPTUM** | The postscriptum of the current container |
|**SELECTION_CONTAINER_VISIBLE** | Whether the current container is visible or not |
|**SELECTION_CONTAINER_POSITION** | The position of the current container |
|**SELECTION_CONTAINER_URL** | The url of the current container |
|**SELECTION_COUNT** | The number of selections in the current container |
### Exemple
````
{loop name="selection_container" type="selection_container" visible="*" backend_context="1" lang=$lang_id order=$selection_container_order}
{$SELECTION_CONTAINER_ID}<br>
{loop type="selection_image" name="selection_image" lang="$edit_language_id" source="selection" source_id=$SELECTION_CONTAINER_ID width="70" height="50" resize_mode="borders" limit="1" visible="true"}
<img class="img-thumbnail" src="{$IMAGE_URL nofilter}" href="{url path="admin/selection/container/update/%selectionContainerId" selectionContainerId=$SELECTION_CONTAINER_ID}">
{/loop}
{{$SELECTION_CONTAINER_ID}}<br>
{$SELECTION_CONTAINER_TITLE}<br>
{$SELECTION_CONTAINER_POSITION}<br>
{/loop}
````

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