Added brands management

This commit is contained in:
Franck Allimant
2014-06-26 10:52:13 +02:00
parent 2cf405c267
commit 0dde8b888a
80 changed files with 23250 additions and 264 deletions

View File

@@ -0,0 +1,132 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Brand\BrandCreateEvent;
use Thelia\Core\Event\Brand\BrandDeleteEvent;
use Thelia\Core\Event\Brand\BrandToggleVisibilityEvent;
use Thelia\Core\Event\Brand\BrandUpdateEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Model\Brand as BrandModel;
use Thelia\Model\BrandQuery;
/**
* Class Brand
*
* @package Thelia\Action
* @author Franck Allimant <franck@cqfdev.fr>
*/
class Brand extends BaseAction implements EventSubscriberInterface
{
public function create(BrandCreateEvent $event)
{
$brand = new BrandModel();
$brand
->setVisible($event->getVisible())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->save()
;
$event->setBrand($brand);
}
/**
* process update brand
*
* @param BrandUpdateEvent $event
*/
public function update(BrandUpdateEvent $event)
{
if (null !== $brand = BrandQuery::create()->findPk($event->getBrandId())) {
$brand->setDispatcher($event->getDispatcher());
$brand
->setVisible($event->getVisible())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->setDescription($event->getDescription())
->setChapo($event->getChapo())
->setPostscriptum($event->getPostscriptum())
->save()
;
$event->setBrand($brand);
}
}
/**
* Toggle Brand visibility
*
* @param BrandToggleVisibilityEvent $event
*/
public function toggleVisibility(BrandToggleVisibilityEvent $event)
{
$brand = $event->getBrand();
$brand
->setDispatcher($event->getDispatcher())
->setVisible(!$brand->getVisible())
->save();
$event->setBrand($brand);
}
/**
* Change Brand SEO
*
* @param \Thelia\Core\Event\UpdateSeoEvent $event
*
* @return mixed
*/
public function updateSeo(UpdateSeoEvent $event)
{
return $this->genericUpdateSeo(BrandQuery::create(), $event);
}
public function delete(BrandDeleteEvent $event)
{
if (null !== $brand = BrandQuery::create()->findPk($event->getBrandId())) {
$brand->setDispatcher($event->getDispatcher())->delete();
$event->setBrand($brand);
}
}
public function updatePosition(UpdatePositionEvent $event)
{
$this->genericUpdatePosition(BrandQuery::create(), $event);
}
/**
* @inheritdoc
*/
public static function getSubscribedEvents()
{
return array(
TheliaEvents::BRAND_CREATE => array('create', 128),
TheliaEvents::BRAND_UPDATE => array('update', 128),
TheliaEvents::BRAND_DELETE => array('delete', 128),
TheliaEvents::BRAND_UPDATE_SEO => array('updateSeo', 128),
TheliaEvents::BRAND_UPDATE_POSITION => array('updatePosition', 128),
TheliaEvents::BRAND_TOGGLE_VISIBILITY => array('toggleVisibility', 128),
);
}
}

View File

@@ -55,9 +55,11 @@
</service> </service>
<service id="thelia.action.image" class="Thelia\Action\Image"> <service id="thelia.action.image" class="Thelia\Action\Image">
<argument type="service" id="thelia.file_manager"/>
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>
</service> </service>
<service id="thelia.action.document" class="Thelia\Action\Document"> <service id="thelia.action.document" class="Thelia\Action\Document">
<argument type="service" id="thelia.file_manager"/>
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>
</service> </service>
@@ -121,6 +123,10 @@
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>
</service> </service>
<service id="thelia.action.brand" class="Thelia\Action\Brand">
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.pdf" class="Thelia\Action\Pdf"> <service id="thelia.action.pdf" class="Thelia\Action\Pdf">
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>

View File

@@ -52,6 +52,12 @@
<form name="thelia.admin.content.image.modification" class="Thelia\Form\ContentImageModification"/> <form name="thelia.admin.content.image.modification" class="Thelia\Form\ContentImageModification"/>
<form name="thelia.admin.content.document.modification" class="Thelia\Form\ContentDocumentModification"/> <form name="thelia.admin.content.document.modification" class="Thelia\Form\ContentDocumentModification"/>
<form name="thelia.admin.brand.creation" class="Thelia\Form\Brand\BrandCreationForm"/>
<form name="thelia.admin.brand.modification" class="Thelia\Form\Brand\BrandModificationForm"/>
<form name="thelia.admin.brand.image.modification" class="Thelia\Form\Brand\BrandImageModification"/>
<form name="thelia.admin.brand.document.modification" class="Thelia\Form\Brand\BrandDocumentModification"/>
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/> <form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
<form name="thelia.order.delivery" class="Thelia\Form\OrderDelivery"/> <form name="thelia.order.delivery" class="Thelia\Form\OrderDelivery"/>

View File

@@ -14,6 +14,7 @@
<loop class="Thelia\Core\Template\Loop\AttributeAvailability" name="attribute_availability"/> <loop class="Thelia\Core\Template\Loop\AttributeAvailability" name="attribute_availability"/>
<loop class="Thelia\Core\Template\Loop\AttributeCombination" name="attribute_combination"/> <loop class="Thelia\Core\Template\Loop\AttributeCombination" name="attribute_combination"/>
<loop class="Thelia\Core\Template\Loop\Auth" name="auth"/> <loop class="Thelia\Core\Template\Loop\Auth" name="auth"/>
<loop class="Thelia\Core\Template\Loop\Brand" name="brand"/>
<loop class="Thelia\Core\Template\Loop\Category" name="category"/> <loop class="Thelia\Core\Template\Loop\Category" name="category"/>
<loop class="Thelia\Core\Template\Loop\Content" name="content"/> <loop class="Thelia\Core\Template\Loop\Content" name="content"/>
<loop class="Thelia\Core\Template\Loop\Country" name="country"/> <loop class="Thelia\Core\Template\Loop\Country" name="country"/>

View File

@@ -1168,6 +1168,43 @@
<default key="_controller">Thelia\Controller\Admin\CustomerExportController::NewsletterExportAction</default> <default key="_controller">Thelia\Controller\Admin\CustomerExportController::NewsletterExportAction</default>
</route> </route>
<!-- Routes to the Brands controller -->
<route id="admin.brand.default" path="/admin/brand">
<default key="_controller">Thelia\Controller\Admin\BrandController::defaultAction</default>
</route>
<route id="admin.brand.create" path="/admin/brand/create">
<default key="_controller">Thelia\Controller\Admin\BrandController::createAction</default>
</route>
<route id="admin.brand.update" path="/admin/brand/update/{brand_id}">
<default key="_controller">Thelia\Controller\Admin\BrandController::updateAction</default>
<requirement key="brand_id">\d+</requirement>
</route>
<route id="admin.brand.save" path="/admin/brand/save/{brand_id}">
<default key="_controller">Thelia\Controller\Admin\BrandController::processUpdateAction</default>
<requirement key="brand_id">\d+</requirement>
</route>
<route id="admin.brand.seo.save" path="/admin/brand/seo/save">
<default key="_controller">Thelia\Controller\Admin\BrandController::processUpdateSeoAction</default>
</route>
<route id="admin.brand.toggle-online" path="/admin/brand/toggle-online">
<default key="_controller">Thelia\Controller\Admin\BrandController::setToggleVisibilityAction</default>
</route>
<route id="admin.brand.update-position" path="/admin/brand/update-position">
<default key="_controller">Thelia\Controller\Admin\BrandController::updatePositionAction</default>
</route>
<route id="admin.brand.delete" path="/admin/brand/delete">
<default key="_controller">Thelia\Controller\Admin\BrandController::deleteAction</default>
</route>
<!-- The default route, to display a template --> <!-- The default route, to display a template -->
<route id="admin.processTemplate" path="/admin/{template}"> <route id="admin.processTemplate" path="/admin/{template}">

View File

@@ -0,0 +1,279 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
use Thelia\Core\Event\Brand\BrandCreateEvent;
use Thelia\Core\Event\Brand\BrandDeleteEvent;
use Thelia\Core\Event\Brand\BrandEvent;
use Thelia\Core\Event\Brand\BrandToggleVisibilityEvent;
use Thelia\Core\Event\Brand\BrandUpdateEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Form\Brand\BrandCreationForm;
use Thelia\Form\Brand\BrandModificationForm;
use Thelia\Model\Brand;
use Thelia\Model\BrandQuery;
/**
* Class BrandController
* @package Thelia\Controller\Admin
* @author Franck Allimant <franck@cqfdev.fr>
*/
class BrandController extends AbstractSeoCrudController
{
public function __construct()
{
parent::__construct(
'brand',
'manual',
'order',
AdminResources::BRAND,
TheliaEvents::BRAND_CREATE,
TheliaEvents::BRAND_UPDATE,
TheliaEvents::BRAND_DELETE,
TheliaEvents::BRAND_TOGGLE_VISIBILITY,
TheliaEvents::BRAND_UPDATE_POSITION,
TheliaEvents::BRAND_UPDATE_SEO
);
}
/**
* Return the creation form for this object
*/
protected function getCreationForm()
{
return new BrandCreationForm($this->getRequest());
}
/**
* Return the update form for this object
*/
protected function getUpdateForm()
{
return new BrandModificationForm($this->getRequest());
}
/**
* Hydrate the update form for this object, before passing it to the update template
*
* @param Brand $object
* @return BrandModificationForm $object
*/
protected function hydrateObjectForm($object)
{
// Hydrate the "SEO" tab form
$this->hydrateSeoForm($object);
// Prepare the data that will hydrate the form
$data = [
'id' => $object->getId(),
'locale' => $object->getLocale(),
'title' => $object->getTitle(),
'chapo' => $object->getChapo(),
'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible() ? true : false
];
// Setup the object form
return new BrandModificationForm($this->getRequest(), "form", $data);
}
/**
* Creates the creation event with the provided form data
*
* @param array $formData
* @return BrandCreateEvent
*/
protected function getCreationEvent($formData)
{
$brandCreateEvent = new BrandCreateEvent();
$brandCreateEvent
->setLocale($formData['locale'])
->setTitle($formData['title'])
->setVisible($formData['visible'])
;
return $brandCreateEvent;
}
/**
* Creates the update event with the provided form data
*
* @param array $formData
* @return BrandUpdateEvent
*/
protected function getUpdateEvent($formData)
{
$brandUpdateEvent = new BrandUpdateEvent($formData['id']);
$brandUpdateEvent
->setLocale($formData['locale'])
->setTitle($formData['title'])
->setChapo($formData['chapo'])
->setDescription($formData['description'])
->setPostscriptum($formData['postscriptum'])
->setVisible($formData['visible'])
;
return $brandUpdateEvent;
}
/**
* Creates the delete event with the provided form data
*
* @return BrandDeleteEvent
*/
protected function getDeleteEvent()
{
return new BrandDeleteEvent($this->getRequest()->get('brand_id'));
}
/**
* Return true if the event contains the object, e.g. the action has updated the object in the event.
*
* @param BrandEvent $event
* @return bool
*/
protected function eventContainsObject($event)
{
return $event->hasBrand();
}
/**
* Get the created object from an event.
*
* @param $event \Thelia\Core\Event\Brand\BrandEvent
*
* @return null|\Thelia\Model\Brand
*/
protected function getObjectFromEvent($event)
{
return $event->getBrand();
}
/**
* Load an existing object from the database
*
* @return \Thelia\Model\Brand
*/
protected function getExistingObject()
{
$brand = BrandQuery::create()
->findOneById($this->getRequest()->get('brand_id', 0));
if (null !== $brand) {
$brand->setLocale($this->getCurrentEditionLocale());
}
return $brand;
}
/**
* Returns the object label form the object event (name, title, etc.)
*
* @param $object \Thelia\Model\Brand
*
* @return string brand title
*/
protected function getObjectLabel($object)
{
return $object->getTitle();
}
/**
* Returns the object ID from the object
*
* @param $object \Thelia\Model\Brand
*
* @return int brand id
*/
protected function getObjectId($object)
{
return $object->getId();
}
/**
* Render the main list template
*
* @param string $currentOrder, if any, null otherwise.
*
* @return Response
*/
protected function renderListTemplate($currentOrder)
{
$this->getListOrderFromSession('brand', 'order', 'manual');
return $this->render('brands', [
'order' => $currentOrder,
]);
}
protected function getEditionArguments()
{
return [
'brand_id' => $this->getRequest()->get('brand_id', 0),
'current_tab' => $this->getRequest()->get('current_tab', 'general')
];
}
/**
* Render the edition template
*/
protected function renderEditionTemplate()
{
return $this->render('brand-edit', $this->getEditionArguments());
}
/**
* Redirect to the edition template
*/
protected function redirectToEditionTemplate()
{
$this->redirect($this->getRoute('admin.brand.update', $this->getEditionArguments()));
}
/**
* Redirect to the list template
*/
protected function redirectToListTemplate()
{
$this->redirectToRoute('admin.brand.default');
}
/**
* @return BrandToggleVisibilityEvent|void
*/
protected function createToggleVisibilityEvent()
{
return new BrandToggleVisibilityEvent($this->getExistingObject());
}
/**
* @inheritdoc
*/
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
{
return new UpdatePositionEvent(
$this->getRequest()->get('brand_id', null),
$positionChangeMode,
$positionValue
);
}
}

View File

@@ -0,0 +1,85 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Brand;
/**
* Class BrandCreateEvent
* @package Thelia\Core\Event\Brand
* @author Franck Allimant <franck@cqfdev.fr>
*/
class BrandCreateEvent extends BrandEvent
{
protected $title;
protected $locale;
protected $visible;
/**
* @param string $locale
*
* @return BrandCreateEvent $this
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* @return string
*/
public function getLocale()
{
return $this->locale;
}
/**
* @param string $title
*
* @return BrandCreateEvent $this
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param bool $visible
*
* @return BrandCreateEvent $this
*/
public function setVisible($visible)
{
$this->visible = $visible;
return $this;
}
/**
* @return bool
*/
public function getVisible()
{
return $this->visible;
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Brand;
/**
* Class BrandDeleteEvent
* @package Thelia\Core\Event\Brand
* @author Franck Allimant <franck@cqfdev.fr>
*/
class BrandDeleteEvent extends BrandEvent
{
protected $brand_id;
public function __construct($brand_id)
{
$this->brand_id = $brand_id;
}
/**
* @param int $brand_id
*
* @return BrandDeleteEvent $this
*/
public function setBrandId($brand_id)
{
$this->brand_id = $brand_id;
return $this;
}
/**
* @return int
*/
public function getBrandId()
{
return $this->brand_id;
}
}

View File

@@ -0,0 +1,63 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Brand;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Brand;
/**
* Class BrandEvent
* @package Thelia\Core\Event\Brand
* @author Franck Allimant <franck@cqfdev.fr>
*/
class BrandEvent extends ActionEvent
{
/**
* @var \Thelia\Model\Brand
*/
protected $brand;
public function __construct(Brand $brand = null)
{
$this->brand = $brand;
}
/**
* @param \Thelia\Model\Brand $brand
* @return BrandEvent
*/
public function setBrand(Brand $brand)
{
$this->brand = $brand;
return $this;
}
/**
* @return \Thelia\Model\Brand
*/
public function getBrand()
{
return $this->brand;
}
/**
* check if brand exists
*
* @return bool
*/
public function hasBrand()
{
return null !== $this->brand;
}
}

View File

@@ -0,0 +1,22 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Brand;
/**
* Class BrandToggleVisibilityEvent
* @package Thelia\Core\Event\Brand
* @author Franck Allimant <franck@cqfdev.fr>
*/
class BrandToggleVisibilityEvent extends BrandEvent
{
}

View File

@@ -0,0 +1,115 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Brand;
/**
* Class BrandUpdateEvent
* @package Thelia\Core\Event\Brand
* @author Franck Allimant <franck@cqfdev.fr>
*/
class BrandUpdateEvent extends BrandCreateEvent
{
protected $brandId;
protected $chapo;
protected $description;
protected $postscriptum;
/**
* @param int $brandId
*/
public function __construct($brandId)
{
$this->brandId = $brandId;
}
/**
* @param string $chapo
*
* @return BrandUpdateEvent $this
*/
public function setChapo($chapo)
{
$this->chapo = $chapo;
return $this;
}
/**
* @return string
*/
public function getChapo()
{
return $this->chapo;
}
/**
* @param int $brandId
*
* @return BrandUpdateEvent $this
*/
public function setBrandId($brandId)
{
$this->brandId = $brandId;
return $this;
}
/**
* @return int
*/
public function getBrandId()
{
return $this->brandId;
}
/**
* @param string $description
*
* @return BrandUpdateEvent $this
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $postscriptum
*
* @return BrandUpdateEvent $this
*/
public function setPostscriptum($postscriptum)
{
$this->postscriptum = $postscriptum;
return $this;
}
/**
* @return string
*/
public function getPostscriptum()
{
return $this->postscriptum;
}
}

View File

@@ -736,4 +736,24 @@ final class TheliaEvents
const BEFORE_DELETELANG = 'action.lang.beforeDelete'; const BEFORE_DELETELANG = 'action.lang.beforeDelete';
const AFTER_DELETELANG = 'action.lang.afterDelete'; const AFTER_DELETELANG = 'action.lang.afterDelete';
// -- Brands management -----------------------------------------------
const BRAND_CREATE = "action.createBrand";
const BRAND_UPDATE = "action.updateBrand";
const BRAND_DELETE = "action.deleteBrand";
const BRAND_UPDATE_POSITION = "action.updateBrandPosition";
const BRAND_TOGGLE_VISIBILITY = "action.toggleBrandVisibility";
const BRAND_UPDATE_SEO = "action.updateBrandSeo";
const BEFORE_CREATEBRAND = "action.before_createBrand";
const AFTER_CREATEBRAND = "action.after_createBrand";
const BEFORE_DELETEBRAND = "action.before_deleteBrand";
const AFTER_DELETEBRAND = "action.after_deleteBrand";
const BEFORE_UPDATEBRAND = "action.before_updateBrand";
const AFTER_UPDATEBRAND = "action.after_updateBrand";
} }

View File

@@ -51,6 +51,8 @@ final class AdminResources
const ATTRIBUTE = "admin.configuration.attribute"; const ATTRIBUTE = "admin.configuration.attribute";
const BRAND = "admin.brand";
const CATEGORY = "admin.category"; const CATEGORY = "admin.category";
const CONFIG = "admin.configuration"; const CONFIG = "admin.configuration";

View File

@@ -0,0 +1,193 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
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\Element\SearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\BrandQuery;
use Thelia\Type\BooleanOrBothType;
use Thelia\Type;
use Thelia\Type\TypeCollection;
/**
*
* Brand loop
*
*
* Class Brand
* @package Thelia\Core\Template\Loop
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class Brand extends BaseI18nLoop implements PropelSearchLoopInterface, SearchLoopInterface
{
protected $timestampable = true;
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createBooleanOrBothTypeArgument('visible', 1),
Argument::createAnyTypeArgument('title'),
new Argument(
'order',
new TypeCollection(
new Type\EnumListType(
array(
'id',
'id-reverse',
'alpha',
'alpha-reverse',
'manual',
'manual-reverse',
'random',
'created',
'created-reverse',
'updated',
'updated-reverse'
)
)
),
'alpha'
),
Argument::createIntListTypeArgument('exclude')
);
}
/**
* @return array of available field to search in
*/
public function getSearchIn()
{
return [
"title"
];
}
public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria)
{
$search->_and();
$search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".$searchCriteria." ?", $searchTerm, \PDO::PARAM_STR);
}
public function buildModelCriteria()
{
$search = BrandQuery::create();
/* manage translations */
$this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
$id = $this->getId();
if (!is_null($id)) {
$search->filterById($id, Criteria::IN);
}
$visible = $this->getVisible();
if ($visible !== BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0);
$title = $this->getTitle();
if (!is_null($title)) {
$search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
}
$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 "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 "random":
$search->clearOrderByColumns();
$search->addAscendingOrderByColumn('RAND()');
break(2);
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;
}
}
$exclude = $this->getExclude();
if (!is_null($exclude)) {
$search->filterById($exclude, Criteria::NOT_IN);
}
return $search;
}
public function parseResults(LoopResult $loopResult)
{
/** @var \Thelia\Model\Brand $brand */
foreach ($loopResult->getResultDataCollection() as $brand) {
$loopResultRow = new LoopResultRow($brand);
$loopResultRow->set("ID" , $brand->getId())
->set("IS_TRANSLATED" , $brand->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE" , $this->locale)
->set("TITLE" , $brand->getVirtualColumn('i18n_TITLE'))
->set("CHAPO" , $brand->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION" , $brand->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM" , $brand->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("URL" , $brand->getUrl($this->locale))
->set("META_TITLE" , $brand->getVirtualColumn('i18n_META_TITLE'))
->set("META_DESCRIPTION" , $brand->getVirtualColumn('i18n_META_DESCRIPTION'))
->set("META_KEYWORDS" , $brand->getVirtualColumn('i18n_META_KEYWORDS'))
->set("POSITION" , $brand->getPosition())
->set("VISIBLE" , $brand->getVisible())
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -41,7 +41,7 @@ class Document extends BaseI18nLoop implements PropelSearchLoopInterface
/** /**
* @var array Possible document sources * @var array Possible document sources
*/ */
protected $possible_sources = array('category', 'product', 'folder', 'content'); protected $possible_sources = array('category', 'product', 'folder', 'content', 'brand');
/** /**
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection

View File

@@ -41,7 +41,7 @@ class Image extends BaseI18nLoop implements PropelSearchLoopInterface
/** /**
* @var array Possible image sources * @var array Possible image sources
*/ */
protected $possible_sources = array('category', 'product', 'folder', 'content', 'module'); protected $possible_sources = array('category', 'product', 'folder', 'content', 'module', 'brand');
/** /**
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection

View File

@@ -95,10 +95,16 @@ class SmartyParser extends Smarty implements ParserInterface
// The default HTTP status // The default HTTP status
$this->status = 200; $this->status = 200;
$this->loadFilter('output', "trimwhitespace"); $this->registerFilter('output', array($this, "removeBlankLines"));
//$this->loadFilter('output', "trimwhitespace");
$this->registerFilter('variable', array(__CLASS__, "theliaEscape")); $this->registerFilter('variable', array(__CLASS__, "theliaEscape"));
} }
public function removeBlankLines($tpl_source, \Smarty_Internal_Template $template)
{
return preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $tpl_source);
}
/** /**
* Add a template directory to the current template list * Add a template directory to the current template list
* *

View File

@@ -96,7 +96,7 @@ abstract class BaseForm
// If not already set, define the success_url field // If not already set, define the success_url field
if (! $this->formBuilder->has('success_url')) { if (! $this->formBuilder->has('success_url')) {
$this->formBuilder->add("success_url", "text"); $this->formBuilder->add("success_url", "hidden");
} }
if (! $this->formBuilder->has('error_message')) { if (! $this->formBuilder->has('error_message')) {

View File

@@ -0,0 +1,78 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Brand;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\True;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
use Thelia\Model\Lang;
/**
* Class BrandCreationForm
* @package Thelia\Form\Brand
* @author Franck Allimant <franck@cqfdev.fr>
*/
class BrandCreationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
// Brand title
->add(
'title',
'text',
[
'constraints' => [ new NotBlank() ],
'required' => true,
'label' => Translator::getInstance()->trans('Brand name'),
'label_attr' => [
'for' => 'title',
'placeholder' => Translator::getInstance()->trans('The brand name or title'),
'help' => Translator::getInstance()->trans(
'Enter here the brand name in the default language (%title%)',
[ '%title%' => Lang::getDefaultLanguage()->getTitle()]
),
'i18n' => 'default'
]
]
)
// Current locale
->add(
'locale',
'hidden',
[
'constraints' => [ new NotBlank() ],
'required' => true,
]
)
// Is this brand online ?
->add(
'visible',
'checkbox',
[
'constraints' => [ ],
'required' => true,
'label' => Translator::getInstance()->trans('This brand is online'),
'label_attr' => [
'for' => 'visible_create'
]
]
);
}
public function getName()
{
return 'thelia_brand_creation';
}
}

View File

@@ -0,0 +1,30 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Brand;
use Thelia\Form\Image\DocumentModification;
/**
* @author Franck Allimant <franck@cqfdev.fr>
*/
class BrandDocumentModification extends DocumentModification
{
/**
* @inheritdoc
*/
public function getName()
{
return 'thelia_brand_document_modification';
}
}

View File

@@ -0,0 +1,30 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Brand;
use Thelia\Form\Image\ImageModification;
/**
* @author Franck Allimant <franck@cqfdev.fr>
*/
class BrandImageModification extends ImageModification
{
/**
* @inheritdoc
*/
public function getName()
{
return 'thelia_brand_image_modification';
}
}

View File

@@ -0,0 +1,66 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Brand;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Thelia\Form\StandardDescriptionFieldsTrait;
/**
* Class BrandModificationForm
* @package Thelia\Form\Brand
* @author Franck Allimant <franck@cqfdev.fr>
*/
class BrandModificationForm extends BrandCreationForm
{
use StandardDescriptionFieldsTrait;
protected function buildForm()
{
parent::buildForm();
$this->formBuilder
->add(
'id',
'hidden',
[
'constraints' => [ new GreaterThan(['value' => 0]) ],
'required' => true,
]
)
// Brand title
->add(
'title',
'text',
[
'constraints' => [ new NotBlank() ],
'required' => true,
'label' => Translator::getInstance()->trans('Brand name'),
'label_attr' => [
'for' => 'title',
'placeholder' => Translator::getInstance()->trans('The brand name or title'),
]
]
)
;
// Add standard description fields, excluding title and locale, which are already defined
$this->addStandardDescFields(array('title', 'locale'));
}
public function getName()
{
return "thelia_brand_modification";
}
}

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,607 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\BrandDocumentI18n as ChildBrandDocumentI18n;
use Thelia\Model\BrandDocumentI18nQuery as ChildBrandDocumentI18nQuery;
use Thelia\Model\Map\BrandDocumentI18nTableMap;
/**
* Base class that represents a query for the 'brand_document_i18n' table.
*
*
*
* @method ChildBrandDocumentI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildBrandDocumentI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildBrandDocumentI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildBrandDocumentI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildBrandDocumentI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildBrandDocumentI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
*
* @method ChildBrandDocumentI18nQuery groupById() Group by the id column
* @method ChildBrandDocumentI18nQuery groupByLocale() Group by the locale column
* @method ChildBrandDocumentI18nQuery groupByTitle() Group by the title column
* @method ChildBrandDocumentI18nQuery groupByDescription() Group by the description column
* @method ChildBrandDocumentI18nQuery groupByChapo() Group by the chapo column
* @method ChildBrandDocumentI18nQuery groupByPostscriptum() Group by the postscriptum column
*
* @method ChildBrandDocumentI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildBrandDocumentI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildBrandDocumentI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildBrandDocumentI18nQuery leftJoinBrandDocument($relationAlias = null) Adds a LEFT JOIN clause to the query using the BrandDocument relation
* @method ChildBrandDocumentI18nQuery rightJoinBrandDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BrandDocument relation
* @method ChildBrandDocumentI18nQuery innerJoinBrandDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the BrandDocument relation
*
* @method ChildBrandDocumentI18n findOne(ConnectionInterface $con = null) Return the first ChildBrandDocumentI18n matching the query
* @method ChildBrandDocumentI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildBrandDocumentI18n matching the query, or a new ChildBrandDocumentI18n object populated from the query conditions when no match is found
*
* @method ChildBrandDocumentI18n findOneById(int $id) Return the first ChildBrandDocumentI18n filtered by the id column
* @method ChildBrandDocumentI18n findOneByLocale(string $locale) Return the first ChildBrandDocumentI18n filtered by the locale column
* @method ChildBrandDocumentI18n findOneByTitle(string $title) Return the first ChildBrandDocumentI18n filtered by the title column
* @method ChildBrandDocumentI18n findOneByDescription(string $description) Return the first ChildBrandDocumentI18n filtered by the description column
* @method ChildBrandDocumentI18n findOneByChapo(string $chapo) Return the first ChildBrandDocumentI18n filtered by the chapo column
* @method ChildBrandDocumentI18n findOneByPostscriptum(string $postscriptum) Return the first ChildBrandDocumentI18n filtered by the postscriptum column
*
* @method array findById(int $id) Return ChildBrandDocumentI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildBrandDocumentI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildBrandDocumentI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildBrandDocumentI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildBrandDocumentI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildBrandDocumentI18n objects filtered by the postscriptum column
*
*/
abstract class BrandDocumentI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\BrandDocumentI18nQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\BrandDocumentI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildBrandDocumentI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildBrandDocumentI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\BrandDocumentI18nQuery) {
return $criteria;
}
$query = new \Thelia\Model\BrandDocumentI18nQuery();
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 ChildBrandDocumentI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = BrandDocumentI18nTableMap::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(BrandDocumentI18nTableMap::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 ChildBrandDocumentI18n 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 `brand_document_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 ChildBrandDocumentI18n();
$obj->hydrate($row);
BrandDocumentI18nTableMap::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 ChildBrandDocumentI18n|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 ChildBrandDocumentI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(BrandDocumentI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(BrandDocumentI18nTableMap::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 ChildBrandDocumentI18nQuery 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(BrandDocumentI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(BrandDocumentI18nTableMap::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 filterByBrandDocument()
*
* @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 ChildBrandDocumentI18nQuery 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(BrandDocumentI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(BrandDocumentI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandDocumentI18nTableMap::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 ChildBrandDocumentI18nQuery 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(BrandDocumentI18nTableMap::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 ChildBrandDocumentI18nQuery 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(BrandDocumentI18nTableMap::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 ChildBrandDocumentI18nQuery 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(BrandDocumentI18nTableMap::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 ChildBrandDocumentI18nQuery 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(BrandDocumentI18nTableMap::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 ChildBrandDocumentI18nQuery 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(BrandDocumentI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\BrandDocument object
*
* @param \Thelia\Model\BrandDocument|ObjectCollection $brandDocument The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildBrandDocumentI18nQuery The current query, for fluid interface
*/
public function filterByBrandDocument($brandDocument, $comparison = null)
{
if ($brandDocument instanceof \Thelia\Model\BrandDocument) {
return $this
->addUsingAlias(BrandDocumentI18nTableMap::ID, $brandDocument->getId(), $comparison);
} elseif ($brandDocument instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(BrandDocumentI18nTableMap::ID, $brandDocument->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByBrandDocument() only accepts arguments of type \Thelia\Model\BrandDocument or Collection');
}
}
/**
* Adds a JOIN clause to the query using the BrandDocument relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildBrandDocumentI18nQuery The current query, for fluid interface
*/
public function joinBrandDocument($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('BrandDocument');
// 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, 'BrandDocument');
}
return $this;
}
/**
* Use the BrandDocument relation BrandDocument 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\BrandDocumentQuery A secondary query class using the current class as primary query
*/
public function useBrandDocumentQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinBrandDocument($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'BrandDocument', '\Thelia\Model\BrandDocumentQuery');
}
/**
* Exclude object from result
*
* @param ChildBrandDocumentI18n $brandDocumentI18n Object to remove from the list of results
*
* @return ChildBrandDocumentI18nQuery The current query, for fluid interface
*/
public function prune($brandDocumentI18n = null)
{
if ($brandDocumentI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(BrandDocumentI18nTableMap::ID), $brandDocumentI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(BrandDocumentI18nTableMap::LOCALE), $brandDocumentI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the brand_document_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(BrandDocumentI18nTableMap::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).
BrandDocumentI18nTableMap::clearInstancePool();
BrandDocumentI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildBrandDocumentI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildBrandDocumentI18n 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(BrandDocumentI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(BrandDocumentI18nTableMap::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();
BrandDocumentI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
BrandDocumentI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // BrandDocumentI18nQuery

View File

@@ -0,0 +1,846 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\BrandDocument as ChildBrandDocument;
use Thelia\Model\BrandDocumentI18nQuery as ChildBrandDocumentI18nQuery;
use Thelia\Model\BrandDocumentQuery as ChildBrandDocumentQuery;
use Thelia\Model\Map\BrandDocumentTableMap;
/**
* Base class that represents a query for the 'brand_document' table.
*
*
*
* @method ChildBrandDocumentQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildBrandDocumentQuery orderByBrandId($order = Criteria::ASC) Order by the brand_id column
* @method ChildBrandDocumentQuery orderByFile($order = Criteria::ASC) Order by the file column
* @method ChildBrandDocumentQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildBrandDocumentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildBrandDocumentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildBrandDocumentQuery groupById() Group by the id column
* @method ChildBrandDocumentQuery groupByBrandId() Group by the brand_id column
* @method ChildBrandDocumentQuery groupByFile() Group by the file column
* @method ChildBrandDocumentQuery groupByPosition() Group by the position column
* @method ChildBrandDocumentQuery groupByCreatedAt() Group by the created_at column
* @method ChildBrandDocumentQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildBrandDocumentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildBrandDocumentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildBrandDocumentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildBrandDocumentQuery leftJoinBrand($relationAlias = null) Adds a LEFT JOIN clause to the query using the Brand relation
* @method ChildBrandDocumentQuery rightJoinBrand($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Brand relation
* @method ChildBrandDocumentQuery innerJoinBrand($relationAlias = null) Adds a INNER JOIN clause to the query using the Brand relation
*
* @method ChildBrandDocumentQuery leftJoinBrandDocumentI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the BrandDocumentI18n relation
* @method ChildBrandDocumentQuery rightJoinBrandDocumentI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BrandDocumentI18n relation
* @method ChildBrandDocumentQuery innerJoinBrandDocumentI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the BrandDocumentI18n relation
*
* @method ChildBrandDocument findOne(ConnectionInterface $con = null) Return the first ChildBrandDocument matching the query
* @method ChildBrandDocument findOneOrCreate(ConnectionInterface $con = null) Return the first ChildBrandDocument matching the query, or a new ChildBrandDocument object populated from the query conditions when no match is found
*
* @method ChildBrandDocument findOneById(int $id) Return the first ChildBrandDocument filtered by the id column
* @method ChildBrandDocument findOneByBrandId(int $brand_id) Return the first ChildBrandDocument filtered by the brand_id column
* @method ChildBrandDocument findOneByFile(string $file) Return the first ChildBrandDocument filtered by the file column
* @method ChildBrandDocument findOneByPosition(int $position) Return the first ChildBrandDocument filtered by the position column
* @method ChildBrandDocument findOneByCreatedAt(string $created_at) Return the first ChildBrandDocument filtered by the created_at column
* @method ChildBrandDocument findOneByUpdatedAt(string $updated_at) Return the first ChildBrandDocument filtered by the updated_at column
*
* @method array findById(int $id) Return ChildBrandDocument objects filtered by the id column
* @method array findByBrandId(int $brand_id) Return ChildBrandDocument objects filtered by the brand_id column
* @method array findByFile(string $file) Return ChildBrandDocument objects filtered by the file column
* @method array findByPosition(int $position) Return ChildBrandDocument objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildBrandDocument objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildBrandDocument objects filtered by the updated_at column
*
*/
abstract class BrandDocumentQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\BrandDocumentQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\BrandDocument', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildBrandDocumentQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildBrandDocumentQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\BrandDocumentQuery) {
return $criteria;
}
$query = new \Thelia\Model\BrandDocumentQuery();
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 ChildBrandDocument|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = BrandDocumentTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(BrandDocumentTableMap::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 ChildBrandDocument A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `BRAND_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `brand_document` 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 ChildBrandDocument();
$obj->hydrate($row);
BrandDocumentTableMap::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 ChildBrandDocument|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 ChildBrandDocumentQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(BrandDocumentTableMap::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 ChildBrandDocumentQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(BrandDocumentTableMap::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 ChildBrandDocumentQuery 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(BrandDocumentTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(BrandDocumentTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandDocumentTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the brand_id column
*
* Example usage:
* <code>
* $query->filterByBrandId(1234); // WHERE brand_id = 1234
* $query->filterByBrandId(array(12, 34)); // WHERE brand_id IN (12, 34)
* $query->filterByBrandId(array('min' => 12)); // WHERE brand_id > 12
* </code>
*
* @see filterByBrand()
*
* @param mixed $brandId 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 ChildBrandDocumentQuery The current query, for fluid interface
*/
public function filterByBrandId($brandId = null, $comparison = null)
{
if (is_array($brandId)) {
$useMinMax = false;
if (isset($brandId['min'])) {
$this->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brandId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($brandId['max'])) {
$this->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brandId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brandId, $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 ChildBrandDocumentQuery 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(BrandDocumentTableMap::FILE, $file, $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 ChildBrandDocumentQuery 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(BrandDocumentTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(BrandDocumentTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandDocumentTableMap::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 ChildBrandDocumentQuery 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(BrandDocumentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(BrandDocumentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandDocumentTableMap::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 ChildBrandDocumentQuery 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(BrandDocumentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(BrandDocumentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandDocumentTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Brand object
*
* @param \Thelia\Model\Brand|ObjectCollection $brand The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildBrandDocumentQuery The current query, for fluid interface
*/
public function filterByBrand($brand, $comparison = null)
{
if ($brand instanceof \Thelia\Model\Brand) {
return $this
->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brand->getId(), $comparison);
} elseif ($brand instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brand->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByBrand() only accepts arguments of type \Thelia\Model\Brand or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Brand relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildBrandDocumentQuery The current query, for fluid interface
*/
public function joinBrand($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Brand');
// 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, 'Brand');
}
return $this;
}
/**
* Use the Brand relation Brand 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\BrandQuery A secondary query class using the current class as primary query
*/
public function useBrandQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinBrand($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Brand', '\Thelia\Model\BrandQuery');
}
/**
* Filter the query by a related \Thelia\Model\BrandDocumentI18n object
*
* @param \Thelia\Model\BrandDocumentI18n|ObjectCollection $brandDocumentI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildBrandDocumentQuery The current query, for fluid interface
*/
public function filterByBrandDocumentI18n($brandDocumentI18n, $comparison = null)
{
if ($brandDocumentI18n instanceof \Thelia\Model\BrandDocumentI18n) {
return $this
->addUsingAlias(BrandDocumentTableMap::ID, $brandDocumentI18n->getId(), $comparison);
} elseif ($brandDocumentI18n instanceof ObjectCollection) {
return $this
->useBrandDocumentI18nQuery()
->filterByPrimaryKeys($brandDocumentI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByBrandDocumentI18n() only accepts arguments of type \Thelia\Model\BrandDocumentI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the BrandDocumentI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildBrandDocumentQuery The current query, for fluid interface
*/
public function joinBrandDocumentI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('BrandDocumentI18n');
// 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, 'BrandDocumentI18n');
}
return $this;
}
/**
* Use the BrandDocumentI18n relation BrandDocumentI18n 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\BrandDocumentI18nQuery A secondary query class using the current class as primary query
*/
public function useBrandDocumentI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinBrandDocumentI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'BrandDocumentI18n', '\Thelia\Model\BrandDocumentI18nQuery');
}
/**
* Exclude object from result
*
* @param ChildBrandDocument $brandDocument Object to remove from the list of results
*
* @return ChildBrandDocumentQuery The current query, for fluid interface
*/
public function prune($brandDocument = null)
{
if ($brandDocument) {
$this->addUsingAlias(BrandDocumentTableMap::ID, $brandDocument->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the brand_document 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(BrandDocumentTableMap::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).
BrandDocumentTableMap::clearInstancePool();
BrandDocumentTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildBrandDocument or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildBrandDocument 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(BrandDocumentTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(BrandDocumentTableMap::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();
BrandDocumentTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
BrandDocumentTableMap::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 ChildBrandDocumentQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(BrandDocumentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildBrandDocumentQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(BrandDocumentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildBrandDocumentQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(BrandDocumentTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildBrandDocumentQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(BrandDocumentTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildBrandDocumentQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(BrandDocumentTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildBrandDocumentQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(BrandDocumentTableMap::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 ChildBrandDocumentQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'BrandDocumentI18n';
return $this
->joinBrandDocumentI18n($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 ChildBrandDocumentQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('BrandDocumentI18n');
$this->with['BrandDocumentI18n']->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 ChildBrandDocumentI18nQuery 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 : 'BrandDocumentI18n', '\Thelia\Model\BrandDocumentI18nQuery');
}
} // BrandDocumentQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,706 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\BrandI18n as ChildBrandI18n;
use Thelia\Model\BrandI18nQuery as ChildBrandI18nQuery;
use Thelia\Model\Map\BrandI18nTableMap;
/**
* Base class that represents a query for the 'brand_i18n' table.
*
*
*
* @method ChildBrandI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildBrandI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildBrandI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildBrandI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildBrandI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildBrandI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ChildBrandI18nQuery orderByMetaTitle($order = Criteria::ASC) Order by the meta_title column
* @method ChildBrandI18nQuery orderByMetaDescription($order = Criteria::ASC) Order by the meta_description column
* @method ChildBrandI18nQuery orderByMetaKeywords($order = Criteria::ASC) Order by the meta_keywords column
*
* @method ChildBrandI18nQuery groupById() Group by the id column
* @method ChildBrandI18nQuery groupByLocale() Group by the locale column
* @method ChildBrandI18nQuery groupByTitle() Group by the title column
* @method ChildBrandI18nQuery groupByDescription() Group by the description column
* @method ChildBrandI18nQuery groupByChapo() Group by the chapo column
* @method ChildBrandI18nQuery groupByPostscriptum() Group by the postscriptum column
* @method ChildBrandI18nQuery groupByMetaTitle() Group by the meta_title column
* @method ChildBrandI18nQuery groupByMetaDescription() Group by the meta_description column
* @method ChildBrandI18nQuery groupByMetaKeywords() Group by the meta_keywords column
*
* @method ChildBrandI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildBrandI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildBrandI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildBrandI18nQuery leftJoinBrand($relationAlias = null) Adds a LEFT JOIN clause to the query using the Brand relation
* @method ChildBrandI18nQuery rightJoinBrand($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Brand relation
* @method ChildBrandI18nQuery innerJoinBrand($relationAlias = null) Adds a INNER JOIN clause to the query using the Brand relation
*
* @method ChildBrandI18n findOne(ConnectionInterface $con = null) Return the first ChildBrandI18n matching the query
* @method ChildBrandI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildBrandI18n matching the query, or a new ChildBrandI18n object populated from the query conditions when no match is found
*
* @method ChildBrandI18n findOneById(int $id) Return the first ChildBrandI18n filtered by the id column
* @method ChildBrandI18n findOneByLocale(string $locale) Return the first ChildBrandI18n filtered by the locale column
* @method ChildBrandI18n findOneByTitle(string $title) Return the first ChildBrandI18n filtered by the title column
* @method ChildBrandI18n findOneByDescription(string $description) Return the first ChildBrandI18n filtered by the description column
* @method ChildBrandI18n findOneByChapo(string $chapo) Return the first ChildBrandI18n filtered by the chapo column
* @method ChildBrandI18n findOneByPostscriptum(string $postscriptum) Return the first ChildBrandI18n filtered by the postscriptum column
* @method ChildBrandI18n findOneByMetaTitle(string $meta_title) Return the first ChildBrandI18n filtered by the meta_title column
* @method ChildBrandI18n findOneByMetaDescription(string $meta_description) Return the first ChildBrandI18n filtered by the meta_description column
* @method ChildBrandI18n findOneByMetaKeywords(string $meta_keywords) Return the first ChildBrandI18n filtered by the meta_keywords column
*
* @method array findById(int $id) Return ChildBrandI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildBrandI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildBrandI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildBrandI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildBrandI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildBrandI18n objects filtered by the postscriptum column
* @method array findByMetaTitle(string $meta_title) Return ChildBrandI18n objects filtered by the meta_title column
* @method array findByMetaDescription(string $meta_description) Return ChildBrandI18n objects filtered by the meta_description column
* @method array findByMetaKeywords(string $meta_keywords) Return ChildBrandI18n objects filtered by the meta_keywords column
*
*/
abstract class BrandI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\BrandI18nQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\BrandI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildBrandI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildBrandI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\BrandI18nQuery) {
return $criteria;
}
$query = new \Thelia\Model\BrandI18nQuery();
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 ChildBrandI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = BrandI18nTableMap::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(BrandI18nTableMap::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 ChildBrandI18n 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 `brand_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 ChildBrandI18n();
$obj->hydrate($row);
BrandI18nTableMap::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 ChildBrandI18n|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 ChildBrandI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(BrandI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(BrandI18nTableMap::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 ChildBrandI18nQuery 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(BrandI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(BrandI18nTableMap::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 filterByBrand()
*
* @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 ChildBrandI18nQuery 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(BrandI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(BrandI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandI18nTableMap::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 ChildBrandI18nQuery 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(BrandI18nTableMap::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 ChildBrandI18nQuery 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(BrandI18nTableMap::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 ChildBrandI18nQuery 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(BrandI18nTableMap::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 ChildBrandI18nQuery 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(BrandI18nTableMap::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 ChildBrandI18nQuery 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(BrandI18nTableMap::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 ChildBrandI18nQuery 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(BrandI18nTableMap::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 ChildBrandI18nQuery 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(BrandI18nTableMap::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 ChildBrandI18nQuery 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(BrandI18nTableMap::META_KEYWORDS, $metaKeywords, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Brand object
*
* @param \Thelia\Model\Brand|ObjectCollection $brand The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildBrandI18nQuery The current query, for fluid interface
*/
public function filterByBrand($brand, $comparison = null)
{
if ($brand instanceof \Thelia\Model\Brand) {
return $this
->addUsingAlias(BrandI18nTableMap::ID, $brand->getId(), $comparison);
} elseif ($brand instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(BrandI18nTableMap::ID, $brand->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByBrand() only accepts arguments of type \Thelia\Model\Brand or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Brand relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildBrandI18nQuery The current query, for fluid interface
*/
public function joinBrand($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Brand');
// 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, 'Brand');
}
return $this;
}
/**
* Use the Brand relation Brand 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\BrandQuery A secondary query class using the current class as primary query
*/
public function useBrandQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinBrand($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Brand', '\Thelia\Model\BrandQuery');
}
/**
* Exclude object from result
*
* @param ChildBrandI18n $brandI18n Object to remove from the list of results
*
* @return ChildBrandI18nQuery The current query, for fluid interface
*/
public function prune($brandI18n = null)
{
if ($brandI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(BrandI18nTableMap::ID), $brandI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(BrandI18nTableMap::LOCALE), $brandI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the brand_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(BrandI18nTableMap::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).
BrandI18nTableMap::clearInstancePool();
BrandI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildBrandI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildBrandI18n 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(BrandI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(BrandI18nTableMap::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();
BrandI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
BrandI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // BrandI18nQuery

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 Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\BrandImageI18n as ChildBrandImageI18n;
use Thelia\Model\BrandImageI18nQuery as ChildBrandImageI18nQuery;
use Thelia\Model\Map\BrandImageI18nTableMap;
/**
* Base class that represents a query for the 'brand_image_i18n' table.
*
*
*
* @method ChildBrandImageI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildBrandImageI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildBrandImageI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildBrandImageI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildBrandImageI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildBrandImageI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
*
* @method ChildBrandImageI18nQuery groupById() Group by the id column
* @method ChildBrandImageI18nQuery groupByLocale() Group by the locale column
* @method ChildBrandImageI18nQuery groupByTitle() Group by the title column
* @method ChildBrandImageI18nQuery groupByDescription() Group by the description column
* @method ChildBrandImageI18nQuery groupByChapo() Group by the chapo column
* @method ChildBrandImageI18nQuery groupByPostscriptum() Group by the postscriptum column
*
* @method ChildBrandImageI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildBrandImageI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildBrandImageI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildBrandImageI18nQuery leftJoinBrandImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the BrandImage relation
* @method ChildBrandImageI18nQuery rightJoinBrandImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BrandImage relation
* @method ChildBrandImageI18nQuery innerJoinBrandImage($relationAlias = null) Adds a INNER JOIN clause to the query using the BrandImage relation
*
* @method ChildBrandImageI18n findOne(ConnectionInterface $con = null) Return the first ChildBrandImageI18n matching the query
* @method ChildBrandImageI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildBrandImageI18n matching the query, or a new ChildBrandImageI18n object populated from the query conditions when no match is found
*
* @method ChildBrandImageI18n findOneById(int $id) Return the first ChildBrandImageI18n filtered by the id column
* @method ChildBrandImageI18n findOneByLocale(string $locale) Return the first ChildBrandImageI18n filtered by the locale column
* @method ChildBrandImageI18n findOneByTitle(string $title) Return the first ChildBrandImageI18n filtered by the title column
* @method ChildBrandImageI18n findOneByDescription(string $description) Return the first ChildBrandImageI18n filtered by the description column
* @method ChildBrandImageI18n findOneByChapo(string $chapo) Return the first ChildBrandImageI18n filtered by the chapo column
* @method ChildBrandImageI18n findOneByPostscriptum(string $postscriptum) Return the first ChildBrandImageI18n filtered by the postscriptum column
*
* @method array findById(int $id) Return ChildBrandImageI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildBrandImageI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildBrandImageI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildBrandImageI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildBrandImageI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildBrandImageI18n objects filtered by the postscriptum column
*
*/
abstract class BrandImageI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\BrandImageI18nQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\BrandImageI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildBrandImageI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildBrandImageI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\BrandImageI18nQuery) {
return $criteria;
}
$query = new \Thelia\Model\BrandImageI18nQuery();
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 ChildBrandImageI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = BrandImageI18nTableMap::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(BrandImageI18nTableMap::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 ChildBrandImageI18n 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 `brand_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 ChildBrandImageI18n();
$obj->hydrate($row);
BrandImageI18nTableMap::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 ChildBrandImageI18n|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 ChildBrandImageI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(BrandImageI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(BrandImageI18nTableMap::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 ChildBrandImageI18nQuery 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(BrandImageI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(BrandImageI18nTableMap::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 filterByBrandImage()
*
* @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 ChildBrandImageI18nQuery 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(BrandImageI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(BrandImageI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandImageI18nTableMap::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 ChildBrandImageI18nQuery 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(BrandImageI18nTableMap::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 ChildBrandImageI18nQuery 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(BrandImageI18nTableMap::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 ChildBrandImageI18nQuery 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(BrandImageI18nTableMap::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 ChildBrandImageI18nQuery 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(BrandImageI18nTableMap::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 ChildBrandImageI18nQuery 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(BrandImageI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\BrandImage object
*
* @param \Thelia\Model\BrandImage|ObjectCollection $brandImage The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildBrandImageI18nQuery The current query, for fluid interface
*/
public function filterByBrandImage($brandImage, $comparison = null)
{
if ($brandImage instanceof \Thelia\Model\BrandImage) {
return $this
->addUsingAlias(BrandImageI18nTableMap::ID, $brandImage->getId(), $comparison);
} elseif ($brandImage instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(BrandImageI18nTableMap::ID, $brandImage->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByBrandImage() only accepts arguments of type \Thelia\Model\BrandImage or Collection');
}
}
/**
* Adds a JOIN clause to the query using the BrandImage relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildBrandImageI18nQuery The current query, for fluid interface
*/
public function joinBrandImage($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('BrandImage');
// 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, 'BrandImage');
}
return $this;
}
/**
* Use the BrandImage relation BrandImage 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\BrandImageQuery A secondary query class using the current class as primary query
*/
public function useBrandImageQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinBrandImage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'BrandImage', '\Thelia\Model\BrandImageQuery');
}
/**
* Exclude object from result
*
* @param ChildBrandImageI18n $brandImageI18n Object to remove from the list of results
*
* @return ChildBrandImageI18nQuery The current query, for fluid interface
*/
public function prune($brandImageI18n = null)
{
if ($brandImageI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(BrandImageI18nTableMap::ID), $brandImageI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(BrandImageI18nTableMap::LOCALE), $brandImageI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the brand_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(BrandImageI18nTableMap::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).
BrandImageI18nTableMap::clearInstancePool();
BrandImageI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildBrandImageI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildBrandImageI18n 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(BrandImageI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(BrandImageI18nTableMap::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();
BrandImageI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
BrandImageI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // BrandImageI18nQuery

View File

@@ -0,0 +1,923 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\BrandImage as ChildBrandImage;
use Thelia\Model\BrandImageI18nQuery as ChildBrandImageI18nQuery;
use Thelia\Model\BrandImageQuery as ChildBrandImageQuery;
use Thelia\Model\Map\BrandImageTableMap;
/**
* Base class that represents a query for the 'brand_image' table.
*
*
*
* @method ChildBrandImageQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildBrandImageQuery orderByBrandId($order = Criteria::ASC) Order by the brand_id column
* @method ChildBrandImageQuery orderByFile($order = Criteria::ASC) Order by the file column
* @method ChildBrandImageQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildBrandImageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildBrandImageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildBrandImageQuery groupById() Group by the id column
* @method ChildBrandImageQuery groupByBrandId() Group by the brand_id column
* @method ChildBrandImageQuery groupByFile() Group by the file column
* @method ChildBrandImageQuery groupByPosition() Group by the position column
* @method ChildBrandImageQuery groupByCreatedAt() Group by the created_at column
* @method ChildBrandImageQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildBrandImageQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildBrandImageQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildBrandImageQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildBrandImageQuery leftJoinBrandRelatedByBrandId($relationAlias = null) Adds a LEFT JOIN clause to the query using the BrandRelatedByBrandId relation
* @method ChildBrandImageQuery rightJoinBrandRelatedByBrandId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BrandRelatedByBrandId relation
* @method ChildBrandImageQuery innerJoinBrandRelatedByBrandId($relationAlias = null) Adds a INNER JOIN clause to the query using the BrandRelatedByBrandId relation
*
* @method ChildBrandImageQuery leftJoinBrandRelatedByLogoImageId($relationAlias = null) Adds a LEFT JOIN clause to the query using the BrandRelatedByLogoImageId relation
* @method ChildBrandImageQuery rightJoinBrandRelatedByLogoImageId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BrandRelatedByLogoImageId relation
* @method ChildBrandImageQuery innerJoinBrandRelatedByLogoImageId($relationAlias = null) Adds a INNER JOIN clause to the query using the BrandRelatedByLogoImageId relation
*
* @method ChildBrandImageQuery leftJoinBrandImageI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the BrandImageI18n relation
* @method ChildBrandImageQuery rightJoinBrandImageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BrandImageI18n relation
* @method ChildBrandImageQuery innerJoinBrandImageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the BrandImageI18n relation
*
* @method ChildBrandImage findOne(ConnectionInterface $con = null) Return the first ChildBrandImage matching the query
* @method ChildBrandImage findOneOrCreate(ConnectionInterface $con = null) Return the first ChildBrandImage matching the query, or a new ChildBrandImage object populated from the query conditions when no match is found
*
* @method ChildBrandImage findOneById(int $id) Return the first ChildBrandImage filtered by the id column
* @method ChildBrandImage findOneByBrandId(int $brand_id) Return the first ChildBrandImage filtered by the brand_id column
* @method ChildBrandImage findOneByFile(string $file) Return the first ChildBrandImage filtered by the file column
* @method ChildBrandImage findOneByPosition(int $position) Return the first ChildBrandImage filtered by the position column
* @method ChildBrandImage findOneByCreatedAt(string $created_at) Return the first ChildBrandImage filtered by the created_at column
* @method ChildBrandImage findOneByUpdatedAt(string $updated_at) Return the first ChildBrandImage filtered by the updated_at column
*
* @method array findById(int $id) Return ChildBrandImage objects filtered by the id column
* @method array findByBrandId(int $brand_id) Return ChildBrandImage objects filtered by the brand_id column
* @method array findByFile(string $file) Return ChildBrandImage objects filtered by the file column
* @method array findByPosition(int $position) Return ChildBrandImage objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildBrandImage objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildBrandImage objects filtered by the updated_at column
*
*/
abstract class BrandImageQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\BrandImageQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\BrandImage', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildBrandImageQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildBrandImageQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\BrandImageQuery) {
return $criteria;
}
$query = new \Thelia\Model\BrandImageQuery();
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 ChildBrandImage|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = BrandImageTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(BrandImageTableMap::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 ChildBrandImage A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `BRAND_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `brand_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 ChildBrandImage();
$obj->hydrate($row);
BrandImageTableMap::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 ChildBrandImage|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 ChildBrandImageQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(BrandImageTableMap::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 ChildBrandImageQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(BrandImageTableMap::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 ChildBrandImageQuery 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(BrandImageTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(BrandImageTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandImageTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the brand_id column
*
* Example usage:
* <code>
* $query->filterByBrandId(1234); // WHERE brand_id = 1234
* $query->filterByBrandId(array(12, 34)); // WHERE brand_id IN (12, 34)
* $query->filterByBrandId(array('min' => 12)); // WHERE brand_id > 12
* </code>
*
* @see filterByBrandRelatedByBrandId()
*
* @param mixed $brandId 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 ChildBrandImageQuery The current query, for fluid interface
*/
public function filterByBrandId($brandId = null, $comparison = null)
{
if (is_array($brandId)) {
$useMinMax = false;
if (isset($brandId['min'])) {
$this->addUsingAlias(BrandImageTableMap::BRAND_ID, $brandId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($brandId['max'])) {
$this->addUsingAlias(BrandImageTableMap::BRAND_ID, $brandId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandImageTableMap::BRAND_ID, $brandId, $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 ChildBrandImageQuery 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(BrandImageTableMap::FILE, $file, $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 ChildBrandImageQuery 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(BrandImageTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(BrandImageTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandImageTableMap::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 ChildBrandImageQuery 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(BrandImageTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(BrandImageTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandImageTableMap::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 ChildBrandImageQuery 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(BrandImageTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(BrandImageTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(BrandImageTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Brand object
*
* @param \Thelia\Model\Brand|ObjectCollection $brand The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function filterByBrandRelatedByBrandId($brand, $comparison = null)
{
if ($brand instanceof \Thelia\Model\Brand) {
return $this
->addUsingAlias(BrandImageTableMap::BRAND_ID, $brand->getId(), $comparison);
} elseif ($brand instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(BrandImageTableMap::BRAND_ID, $brand->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByBrandRelatedByBrandId() only accepts arguments of type \Thelia\Model\Brand or Collection');
}
}
/**
* Adds a JOIN clause to the query using the BrandRelatedByBrandId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function joinBrandRelatedByBrandId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('BrandRelatedByBrandId');
// 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, 'BrandRelatedByBrandId');
}
return $this;
}
/**
* Use the BrandRelatedByBrandId relation Brand 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\BrandQuery A secondary query class using the current class as primary query
*/
public function useBrandRelatedByBrandIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinBrandRelatedByBrandId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'BrandRelatedByBrandId', '\Thelia\Model\BrandQuery');
}
/**
* Filter the query by a related \Thelia\Model\Brand object
*
* @param \Thelia\Model\Brand|ObjectCollection $brand the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function filterByBrandRelatedByLogoImageId($brand, $comparison = null)
{
if ($brand instanceof \Thelia\Model\Brand) {
return $this
->addUsingAlias(BrandImageTableMap::ID, $brand->getLogoImageId(), $comparison);
} elseif ($brand instanceof ObjectCollection) {
return $this
->useBrandRelatedByLogoImageIdQuery()
->filterByPrimaryKeys($brand->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByBrandRelatedByLogoImageId() only accepts arguments of type \Thelia\Model\Brand or Collection');
}
}
/**
* Adds a JOIN clause to the query using the BrandRelatedByLogoImageId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function joinBrandRelatedByLogoImageId($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('BrandRelatedByLogoImageId');
// 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, 'BrandRelatedByLogoImageId');
}
return $this;
}
/**
* Use the BrandRelatedByLogoImageId relation Brand 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\BrandQuery A secondary query class using the current class as primary query
*/
public function useBrandRelatedByLogoImageIdQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinBrandRelatedByLogoImageId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'BrandRelatedByLogoImageId', '\Thelia\Model\BrandQuery');
}
/**
* Filter the query by a related \Thelia\Model\BrandImageI18n object
*
* @param \Thelia\Model\BrandImageI18n|ObjectCollection $brandImageI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function filterByBrandImageI18n($brandImageI18n, $comparison = null)
{
if ($brandImageI18n instanceof \Thelia\Model\BrandImageI18n) {
return $this
->addUsingAlias(BrandImageTableMap::ID, $brandImageI18n->getId(), $comparison);
} elseif ($brandImageI18n instanceof ObjectCollection) {
return $this
->useBrandImageI18nQuery()
->filterByPrimaryKeys($brandImageI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByBrandImageI18n() only accepts arguments of type \Thelia\Model\BrandImageI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the BrandImageI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function joinBrandImageI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('BrandImageI18n');
// 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, 'BrandImageI18n');
}
return $this;
}
/**
* Use the BrandImageI18n relation BrandImageI18n 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\BrandImageI18nQuery A secondary query class using the current class as primary query
*/
public function useBrandImageI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinBrandImageI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'BrandImageI18n', '\Thelia\Model\BrandImageI18nQuery');
}
/**
* Exclude object from result
*
* @param ChildBrandImage $brandImage Object to remove from the list of results
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function prune($brandImage = null)
{
if ($brandImage) {
$this->addUsingAlias(BrandImageTableMap::ID, $brandImage->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the brand_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(BrandImageTableMap::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).
BrandImageTableMap::clearInstancePool();
BrandImageTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildBrandImage or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildBrandImage 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(BrandImageTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(BrandImageTableMap::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();
BrandImageTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
BrandImageTableMap::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 ChildBrandImageQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(BrandImageTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(BrandImageTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(BrandImageTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(BrandImageTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(BrandImageTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildBrandImageQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(BrandImageTableMap::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 ChildBrandImageQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'BrandImageI18n';
return $this
->joinBrandImageI18n($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 ChildBrandImageQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('BrandImageI18n');
$this->with['BrandImageI18n']->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 ChildBrandImageI18nQuery 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 : 'BrandImageI18n', '\Thelia\Model\BrandImageI18nQuery');
}
} // BrandImageQuery

File diff suppressed because it is too large Load Diff

View File

@@ -169,6 +169,18 @@ abstract class Coupon implements ActiveRecordInterface
*/ */
protected $version; protected $version;
/**
* The value for the version_created_at field.
* @var string
*/
protected $version_created_at;
/**
* The value for the version_created_by field.
* @var string
*/
protected $version_created_by;
/** /**
* @var ObjectCollection|ChildCouponCountry[] Collection to store aggregation of ChildCouponCountry objects. * @var ObjectCollection|ChildCouponCountry[] Collection to store aggregation of ChildCouponCountry objects.
*/ */
@@ -766,6 +778,37 @@ abstract class Coupon implements ActiveRecordInterface
return $this->version; return $this->version;
} }
/**
* Get the [optionally formatted] temporal [version_created_at] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw \DateTime object will be returned.
*
* @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
*
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getVersionCreatedAt($format = NULL)
{
if ($format === null) {
return $this->version_created_at;
} else {
return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null;
}
}
/**
* Get the [version_created_by] column value.
*
* @return string
*/
public function getVersionCreatedBy()
{
return $this->version_created_by;
}
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
@@ -1150,6 +1193,48 @@ abstract class Coupon implements ActiveRecordInterface
return $this; return $this;
} // setVersion() } // setVersion()
/**
* Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL.
* @return \Thelia\Model\Coupon The current object (for fluent API support)
*/
public function setVersionCreatedAt($v)
{
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
if ($this->version_created_at !== null || $dt !== null) {
if ($dt !== $this->version_created_at) {
$this->version_created_at = $dt;
$this->modifiedColumns[CouponTableMap::VERSION_CREATED_AT] = true;
}
} // if either are not null
return $this;
} // setVersionCreatedAt()
/**
* Set the value of [version_created_by] column.
*
* @param string $v new value
* @return \Thelia\Model\Coupon The current object (for fluent API support)
*/
public function setVersionCreatedBy($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->version_created_by !== $v) {
$this->version_created_by = $v;
$this->modifiedColumns[CouponTableMap::VERSION_CREATED_BY] = true;
}
return $this;
} // setVersionCreatedBy()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
* *
@@ -1247,6 +1332,15 @@ abstract class Coupon implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null; $this->version = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : CouponTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CouponTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@@ -1255,7 +1349,7 @@ abstract class Coupon implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 16; // 16 = CouponTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 18; // 18 = CouponTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Coupon object", 0, $e); throw new PropelException("Error populating \Thelia\Model\Coupon object", 0, $e);
@@ -1400,6 +1494,9 @@ abstract class Coupon implements ActiveRecordInterface
// versionable behavior // versionable behavior
if ($this->isVersioningNecessary()) { if ($this->isVersioningNecessary()) {
$this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1); $this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1);
if (!$this->isColumnModified(CouponTableMap::VERSION_CREATED_AT)) {
$this->setVersionCreatedAt(time());
}
$createVersion = true; // for postSave hook $createVersion = true; // for postSave hook
} }
if ($isInsert) { if ($isInsert) {
@@ -1711,6 +1808,12 @@ abstract class Coupon implements ActiveRecordInterface
if ($this->isColumnModified(CouponTableMap::VERSION)) { if ($this->isColumnModified(CouponTableMap::VERSION)) {
$modifiedColumns[':p' . $index++] = '`VERSION`'; $modifiedColumns[':p' . $index++] = '`VERSION`';
} }
if ($this->isColumnModified(CouponTableMap::VERSION_CREATED_AT)) {
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
}
if ($this->isColumnModified(CouponTableMap::VERSION_CREATED_BY)) {
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
}
$sql = sprintf( $sql = sprintf(
'INSERT INTO `coupon` (%s) VALUES (%s)', 'INSERT INTO `coupon` (%s) VALUES (%s)',
@@ -1770,6 +1873,12 @@ abstract class Coupon implements ActiveRecordInterface
case '`VERSION`': case '`VERSION`':
$stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
break; break;
case '`VERSION_CREATED_AT`':
$stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
case '`VERSION_CREATED_BY`':
$stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
break;
} }
} }
$stmt->execute(); $stmt->execute();
@@ -1880,6 +1989,12 @@ abstract class Coupon implements ActiveRecordInterface
case 15: case 15:
return $this->getVersion(); return $this->getVersion();
break; break;
case 16:
return $this->getVersionCreatedAt();
break;
case 17:
return $this->getVersionCreatedBy();
break;
default: default:
return null; return null;
break; break;
@@ -1925,6 +2040,8 @@ abstract class Coupon implements ActiveRecordInterface
$keys[13] => $this->getCreatedAt(), $keys[13] => $this->getCreatedAt(),
$keys[14] => $this->getUpdatedAt(), $keys[14] => $this->getUpdatedAt(),
$keys[15] => $this->getVersion(), $keys[15] => $this->getVersion(),
$keys[16] => $this->getVersionCreatedAt(),
$keys[17] => $this->getVersionCreatedBy(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@@ -2029,6 +2146,12 @@ abstract class Coupon implements ActiveRecordInterface
case 15: case 15:
$this->setVersion($value); $this->setVersion($value);
break; break;
case 16:
$this->setVersionCreatedAt($value);
break;
case 17:
$this->setVersionCreatedBy($value);
break;
} // switch() } // switch()
} }
@@ -2069,6 +2192,8 @@ abstract class Coupon implements ActiveRecordInterface
if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]); if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]); if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setVersion($arr[$keys[15]]); if (array_key_exists($keys[15], $arr)) $this->setVersion($arr[$keys[15]]);
if (array_key_exists($keys[16], $arr)) $this->setVersionCreatedAt($arr[$keys[16]]);
if (array_key_exists($keys[17], $arr)) $this->setVersionCreatedBy($arr[$keys[17]]);
} }
/** /**
@@ -2096,6 +2221,8 @@ abstract class Coupon implements ActiveRecordInterface
if ($this->isColumnModified(CouponTableMap::CREATED_AT)) $criteria->add(CouponTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(CouponTableMap::CREATED_AT)) $criteria->add(CouponTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(CouponTableMap::UPDATED_AT)) $criteria->add(CouponTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(CouponTableMap::UPDATED_AT)) $criteria->add(CouponTableMap::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(CouponTableMap::VERSION)) $criteria->add(CouponTableMap::VERSION, $this->version); if ($this->isColumnModified(CouponTableMap::VERSION)) $criteria->add(CouponTableMap::VERSION, $this->version);
if ($this->isColumnModified(CouponTableMap::VERSION_CREATED_AT)) $criteria->add(CouponTableMap::VERSION_CREATED_AT, $this->version_created_at);
if ($this->isColumnModified(CouponTableMap::VERSION_CREATED_BY)) $criteria->add(CouponTableMap::VERSION_CREATED_BY, $this->version_created_by);
return $criteria; return $criteria;
} }
@@ -2174,6 +2301,8 @@ abstract class Coupon implements ActiveRecordInterface
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion()); $copyObj->setVersion($this->getVersion());
$copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
$copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
if ($deepCopy) { if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of // important: temporarily setNew(false) because this affects the behavior of
@@ -4019,6 +4148,8 @@ abstract class Coupon implements ActiveRecordInterface
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->version = null; $this->version = null;
$this->version_created_at = null;
$this->version_created_by = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->clearAllReferences(); $this->clearAllReferences();
$this->applyDefaultValues(); $this->applyDefaultValues();
@@ -4354,6 +4485,8 @@ abstract class Coupon implements ActiveRecordInterface
$version->setCreatedAt($this->getCreatedAt()); $version->setCreatedAt($this->getCreatedAt());
$version->setUpdatedAt($this->getUpdatedAt()); $version->setUpdatedAt($this->getUpdatedAt());
$version->setVersion($this->getVersion()); $version->setVersion($this->getVersion());
$version->setVersionCreatedAt($this->getVersionCreatedAt());
$version->setVersionCreatedBy($this->getVersionCreatedBy());
$version->setCoupon($this); $version->setCoupon($this);
$version->save($con); $version->save($con);
@@ -4407,6 +4540,8 @@ abstract class Coupon implements ActiveRecordInterface
$this->setCreatedAt($version->getCreatedAt()); $this->setCreatedAt($version->getCreatedAt());
$this->setUpdatedAt($version->getUpdatedAt()); $this->setUpdatedAt($version->getUpdatedAt());
$this->setVersion($version->getVersion()); $this->setVersion($version->getVersion());
$this->setVersionCreatedAt($version->getVersionCreatedAt());
$this->setVersionCreatedBy($version->getVersionCreatedBy());
return $this; return $this;
} }
@@ -4548,6 +4683,8 @@ abstract class Coupon implements ActiveRecordInterface
$toVersionNumber = $toVersion['Version']; $toVersionNumber = $toVersion['Version'];
$ignoredColumns = array_merge(array( $ignoredColumns = array_merge(array(
'Version', 'Version',
'VersionCreatedAt',
'VersionCreatedBy',
), $ignoredColumns); ), $ignoredColumns);
$diff = array(); $diff = array();
foreach ($fromVersion as $key => $value) { foreach ($fromVersion as $key => $value) {

View File

@@ -38,6 +38,8 @@ use Thelia\Model\Map\CouponTableMap;
* @method ChildCouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildCouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCouponQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildCouponQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildCouponQuery orderByVersion($order = Criteria::ASC) Order by the version column * @method ChildCouponQuery orderByVersion($order = Criteria::ASC) Order by the version column
* @method ChildCouponQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
* @method ChildCouponQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
* *
* @method ChildCouponQuery groupById() Group by the id column * @method ChildCouponQuery groupById() Group by the id column
* @method ChildCouponQuery groupByCode() Group by the code column * @method ChildCouponQuery groupByCode() Group by the code column
@@ -55,6 +57,8 @@ use Thelia\Model\Map\CouponTableMap;
* @method ChildCouponQuery groupByCreatedAt() Group by the created_at column * @method ChildCouponQuery groupByCreatedAt() Group by the created_at column
* @method ChildCouponQuery groupByUpdatedAt() Group by the updated_at column * @method ChildCouponQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildCouponQuery groupByVersion() Group by the version column * @method ChildCouponQuery groupByVersion() Group by the version column
* @method ChildCouponQuery groupByVersionCreatedAt() Group by the version_created_at column
* @method ChildCouponQuery groupByVersionCreatedBy() Group by the version_created_by column
* *
* @method ChildCouponQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildCouponQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildCouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -99,6 +103,8 @@ use Thelia\Model\Map\CouponTableMap;
* @method ChildCoupon findOneByCreatedAt(string $created_at) Return the first ChildCoupon filtered by the created_at column * @method ChildCoupon findOneByCreatedAt(string $created_at) Return the first ChildCoupon filtered by the created_at column
* @method ChildCoupon findOneByUpdatedAt(string $updated_at) Return the first ChildCoupon filtered by the updated_at column * @method ChildCoupon findOneByUpdatedAt(string $updated_at) Return the first ChildCoupon filtered by the updated_at column
* @method ChildCoupon findOneByVersion(int $version) Return the first ChildCoupon filtered by the version column * @method ChildCoupon findOneByVersion(int $version) Return the first ChildCoupon filtered by the version column
* @method ChildCoupon findOneByVersionCreatedAt(string $version_created_at) Return the first ChildCoupon filtered by the version_created_at column
* @method ChildCoupon findOneByVersionCreatedBy(string $version_created_by) Return the first ChildCoupon filtered by the version_created_by column
* *
* @method array findById(int $id) Return ChildCoupon objects filtered by the id column * @method array findById(int $id) Return ChildCoupon objects filtered by the id column
* @method array findByCode(string $code) Return ChildCoupon objects filtered by the code column * @method array findByCode(string $code) Return ChildCoupon objects filtered by the code column
@@ -116,6 +122,8 @@ use Thelia\Model\Map\CouponTableMap;
* @method array findByCreatedAt(string $created_at) Return ChildCoupon objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildCoupon objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCoupon objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildCoupon objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildCoupon objects filtered by the version column * @method array findByVersion(int $version) Return ChildCoupon objects filtered by the version column
* @method array findByVersionCreatedAt(string $version_created_at) Return ChildCoupon objects filtered by the version_created_at column
* @method array findByVersionCreatedBy(string $version_created_by) Return ChildCoupon objects filtered by the version_created_by column
* *
*/ */
abstract class CouponQuery extends ModelCriteria abstract class CouponQuery extends ModelCriteria
@@ -211,7 +219,7 @@ abstract class CouponQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon` WHERE `ID` = :p0'; $sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `coupon` WHERE `ID` = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -830,6 +838,78 @@ abstract class CouponQuery extends ModelCriteria
return $this->addUsingAlias(CouponTableMap::VERSION, $version, $comparison); return $this->addUsingAlias(CouponTableMap::VERSION, $version, $comparison);
} }
/**
* Filter the query on the version_created_at column
*
* Example usage:
* <code>
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
* </code>
*
* @param mixed $versionCreatedAt 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 ChildCouponQuery The current query, for fluid interface
*/
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
{
if (is_array($versionCreatedAt)) {
$useMinMax = false;
if (isset($versionCreatedAt['min'])) {
$this->addUsingAlias(CouponTableMap::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($versionCreatedAt['max'])) {
$this->addUsingAlias(CouponTableMap::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponTableMap::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
}
/**
* Filter the query on the version_created_by column
*
* Example usage:
* <code>
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
* </code>
*
* @param string $versionCreatedBy 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 ChildCouponQuery The current query, for fluid interface
*/
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($versionCreatedBy)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
}
/** /**
* Filter the query by a related \Thelia\Model\CouponCountry object * Filter the query by a related \Thelia\Model\CouponCountry object
* *

View File

@@ -152,6 +152,18 @@ abstract class CouponVersion implements ActiveRecordInterface
*/ */
protected $version; protected $version;
/**
* The value for the version_created_at field.
* @var string
*/
protected $version_created_at;
/**
* The value for the version_created_by field.
* @var string
*/
protected $version_created_by;
/** /**
* @var Coupon * @var Coupon
*/ */
@@ -639,6 +651,37 @@ abstract class CouponVersion implements ActiveRecordInterface
return $this->version; return $this->version;
} }
/**
* Get the [optionally formatted] temporal [version_created_at] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw \DateTime object will be returned.
*
* @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
*
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getVersionCreatedAt($format = NULL)
{
if ($format === null) {
return $this->version_created_at;
} else {
return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null;
}
}
/**
* Get the [version_created_by] column value.
*
* @return string
*/
public function getVersionCreatedBy()
{
return $this->version_created_by;
}
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
@@ -1027,6 +1070,48 @@ abstract class CouponVersion implements ActiveRecordInterface
return $this; return $this;
} // setVersion() } // setVersion()
/**
* Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL.
* @return \Thelia\Model\CouponVersion The current object (for fluent API support)
*/
public function setVersionCreatedAt($v)
{
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
if ($this->version_created_at !== null || $dt !== null) {
if ($dt !== $this->version_created_at) {
$this->version_created_at = $dt;
$this->modifiedColumns[CouponVersionTableMap::VERSION_CREATED_AT] = true;
}
} // if either are not null
return $this;
} // setVersionCreatedAt()
/**
* Set the value of [version_created_by] column.
*
* @param string $v new value
* @return \Thelia\Model\CouponVersion The current object (for fluent API support)
*/
public function setVersionCreatedBy($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->version_created_by !== $v) {
$this->version_created_by = $v;
$this->modifiedColumns[CouponVersionTableMap::VERSION_CREATED_BY] = true;
}
return $this;
} // setVersionCreatedBy()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
* *
@@ -1124,6 +1209,15 @@ abstract class CouponVersion implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null; $this->version = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : CouponVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CouponVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@@ -1132,7 +1226,7 @@ abstract class CouponVersion implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 16; // 16 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 18; // 18 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\CouponVersion object", 0, $e); throw new PropelException("Error populating \Thelia\Model\CouponVersion object", 0, $e);
@@ -1401,6 +1495,12 @@ abstract class CouponVersion implements ActiveRecordInterface
if ($this->isColumnModified(CouponVersionTableMap::VERSION)) { if ($this->isColumnModified(CouponVersionTableMap::VERSION)) {
$modifiedColumns[':p' . $index++] = '`VERSION`'; $modifiedColumns[':p' . $index++] = '`VERSION`';
} }
if ($this->isColumnModified(CouponVersionTableMap::VERSION_CREATED_AT)) {
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
}
if ($this->isColumnModified(CouponVersionTableMap::VERSION_CREATED_BY)) {
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
}
$sql = sprintf( $sql = sprintf(
'INSERT INTO `coupon_version` (%s) VALUES (%s)', 'INSERT INTO `coupon_version` (%s) VALUES (%s)',
@@ -1460,6 +1560,12 @@ abstract class CouponVersion implements ActiveRecordInterface
case '`VERSION`': case '`VERSION`':
$stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
break; break;
case '`VERSION_CREATED_AT`':
$stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
case '`VERSION_CREATED_BY`':
$stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
break;
} }
} }
$stmt->execute(); $stmt->execute();
@@ -1563,6 +1669,12 @@ abstract class CouponVersion implements ActiveRecordInterface
case 15: case 15:
return $this->getVersion(); return $this->getVersion();
break; break;
case 16:
return $this->getVersionCreatedAt();
break;
case 17:
return $this->getVersionCreatedBy();
break;
default: default:
return null; return null;
break; break;
@@ -1608,6 +1720,8 @@ abstract class CouponVersion implements ActiveRecordInterface
$keys[13] => $this->getCreatedAt(), $keys[13] => $this->getCreatedAt(),
$keys[14] => $this->getUpdatedAt(), $keys[14] => $this->getUpdatedAt(),
$keys[15] => $this->getVersion(), $keys[15] => $this->getVersion(),
$keys[16] => $this->getVersionCreatedAt(),
$keys[17] => $this->getVersionCreatedBy(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1700,6 +1814,12 @@ abstract class CouponVersion implements ActiveRecordInterface
case 15: case 15:
$this->setVersion($value); $this->setVersion($value);
break; break;
case 16:
$this->setVersionCreatedAt($value);
break;
case 17:
$this->setVersionCreatedBy($value);
break;
} // switch() } // switch()
} }
@@ -1740,6 +1860,8 @@ abstract class CouponVersion implements ActiveRecordInterface
if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]); if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]); if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setVersion($arr[$keys[15]]); if (array_key_exists($keys[15], $arr)) $this->setVersion($arr[$keys[15]]);
if (array_key_exists($keys[16], $arr)) $this->setVersionCreatedAt($arr[$keys[16]]);
if (array_key_exists($keys[17], $arr)) $this->setVersionCreatedBy($arr[$keys[17]]);
} }
/** /**
@@ -1767,6 +1889,8 @@ abstract class CouponVersion implements ActiveRecordInterface
if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) $criteria->add(CouponVersionTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) $criteria->add(CouponVersionTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(CouponVersionTableMap::UPDATED_AT)) $criteria->add(CouponVersionTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(CouponVersionTableMap::UPDATED_AT)) $criteria->add(CouponVersionTableMap::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(CouponVersionTableMap::VERSION)) $criteria->add(CouponVersionTableMap::VERSION, $this->version); if ($this->isColumnModified(CouponVersionTableMap::VERSION)) $criteria->add(CouponVersionTableMap::VERSION, $this->version);
if ($this->isColumnModified(CouponVersionTableMap::VERSION_CREATED_AT)) $criteria->add(CouponVersionTableMap::VERSION_CREATED_AT, $this->version_created_at);
if ($this->isColumnModified(CouponVersionTableMap::VERSION_CREATED_BY)) $criteria->add(CouponVersionTableMap::VERSION_CREATED_BY, $this->version_created_by);
return $criteria; return $criteria;
} }
@@ -1853,6 +1977,8 @@ abstract class CouponVersion implements ActiveRecordInterface
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion()); $copyObj->setVersion($this->getVersion());
$copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
$copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
if ($makeNew) { if ($makeNew) {
$copyObj->setNew(true); $copyObj->setNew(true);
} }
@@ -1952,6 +2078,8 @@ abstract class CouponVersion implements ActiveRecordInterface
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->version = null; $this->version = null;
$this->version_created_at = null;
$this->version_created_by = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->clearAllReferences(); $this->clearAllReferences();
$this->applyDefaultValues(); $this->applyDefaultValues();

View File

@@ -37,6 +37,8 @@ use Thelia\Model\Map\CouponVersionTableMap;
* @method ChildCouponVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildCouponVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCouponVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildCouponVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildCouponVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column * @method ChildCouponVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
* @method ChildCouponVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
* @method ChildCouponVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
* *
* @method ChildCouponVersionQuery groupById() Group by the id column * @method ChildCouponVersionQuery groupById() Group by the id column
* @method ChildCouponVersionQuery groupByCode() Group by the code column * @method ChildCouponVersionQuery groupByCode() Group by the code column
@@ -54,6 +56,8 @@ use Thelia\Model\Map\CouponVersionTableMap;
* @method ChildCouponVersionQuery groupByCreatedAt() Group by the created_at column * @method ChildCouponVersionQuery groupByCreatedAt() Group by the created_at column
* @method ChildCouponVersionQuery groupByUpdatedAt() Group by the updated_at column * @method ChildCouponVersionQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildCouponVersionQuery groupByVersion() Group by the version column * @method ChildCouponVersionQuery groupByVersion() Group by the version column
* @method ChildCouponVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
* @method ChildCouponVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
* *
* @method ChildCouponVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildCouponVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCouponVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildCouponVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -82,6 +86,8 @@ use Thelia\Model\Map\CouponVersionTableMap;
* @method ChildCouponVersion findOneByCreatedAt(string $created_at) Return the first ChildCouponVersion filtered by the created_at column * @method ChildCouponVersion findOneByCreatedAt(string $created_at) Return the first ChildCouponVersion filtered by the created_at column
* @method ChildCouponVersion findOneByUpdatedAt(string $updated_at) Return the first ChildCouponVersion filtered by the updated_at column * @method ChildCouponVersion findOneByUpdatedAt(string $updated_at) Return the first ChildCouponVersion filtered by the updated_at column
* @method ChildCouponVersion findOneByVersion(int $version) Return the first ChildCouponVersion filtered by the version column * @method ChildCouponVersion findOneByVersion(int $version) Return the first ChildCouponVersion filtered by the version column
* @method ChildCouponVersion findOneByVersionCreatedAt(string $version_created_at) Return the first ChildCouponVersion filtered by the version_created_at column
* @method ChildCouponVersion findOneByVersionCreatedBy(string $version_created_by) Return the first ChildCouponVersion filtered by the version_created_by column
* *
* @method array findById(int $id) Return ChildCouponVersion objects filtered by the id column * @method array findById(int $id) Return ChildCouponVersion objects filtered by the id column
* @method array findByCode(string $code) Return ChildCouponVersion objects filtered by the code column * @method array findByCode(string $code) Return ChildCouponVersion objects filtered by the code column
@@ -99,6 +105,8 @@ use Thelia\Model\Map\CouponVersionTableMap;
* @method array findByCreatedAt(string $created_at) Return ChildCouponVersion objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildCouponVersion objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCouponVersion objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildCouponVersion objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildCouponVersion objects filtered by the version column * @method array findByVersion(int $version) Return ChildCouponVersion objects filtered by the version column
* @method array findByVersionCreatedAt(string $version_created_at) Return ChildCouponVersion objects filtered by the version_created_at column
* @method array findByVersionCreatedBy(string $version_created_by) Return ChildCouponVersion objects filtered by the version_created_by column
* *
*/ */
abstract class CouponVersionQuery extends ModelCriteria abstract class CouponVersionQuery extends ModelCriteria
@@ -187,7 +195,7 @@ abstract class CouponVersionQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon_version` WHERE `ID` = :p0 AND `VERSION` = :p1'; $sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `coupon_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -820,6 +828,78 @@ abstract class CouponVersionQuery extends ModelCriteria
return $this->addUsingAlias(CouponVersionTableMap::VERSION, $version, $comparison); return $this->addUsingAlias(CouponVersionTableMap::VERSION, $version, $comparison);
} }
/**
* Filter the query on the version_created_at column
*
* Example usage:
* <code>
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
* </code>
*
* @param mixed $versionCreatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
{
if (is_array($versionCreatedAt)) {
$useMinMax = false;
if (isset($versionCreatedAt['min'])) {
$this->addUsingAlias(CouponVersionTableMap::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($versionCreatedAt['max'])) {
$this->addUsingAlias(CouponVersionTableMap::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponVersionTableMap::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
}
/**
* Filter the query on the version_created_by column
*
* Example usage:
* <code>
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
* </code>
*
* @param string $versionCreatedBy The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponVersionQuery The current query, for fluid interface
*/
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($versionCreatedBy)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CouponVersionTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
}
/** /**
* Filter the query by a related \Thelia\Model\Coupon object * Filter the query by a related \Thelia\Model\Coupon object
* *

View File

@@ -19,6 +19,8 @@ use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime; use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Accessory as ChildAccessory; use Thelia\Model\Accessory as ChildAccessory;
use Thelia\Model\AccessoryQuery as ChildAccessoryQuery; use Thelia\Model\AccessoryQuery as ChildAccessoryQuery;
use Thelia\Model\Brand as ChildBrand;
use Thelia\Model\BrandQuery as ChildBrandQuery;
use Thelia\Model\CartItem as ChildCartItem; use Thelia\Model\CartItem as ChildCartItem;
use Thelia\Model\CartItemQuery as ChildCartItemQuery; use Thelia\Model\CartItemQuery as ChildCartItemQuery;
use Thelia\Model\Category as ChildCategory; use Thelia\Model\Category as ChildCategory;
@@ -120,6 +122,12 @@ abstract class Product implements ActiveRecordInterface
*/ */
protected $template_id; protected $template_id;
/**
* The value for the brand_id field.
* @var int
*/
protected $brand_id;
/** /**
* The value for the created_at field. * The value for the created_at field.
* @var string * @var string
@@ -161,6 +169,11 @@ abstract class Product implements ActiveRecordInterface
*/ */
protected $aTemplate; protected $aTemplate;
/**
* @var Brand
*/
protected $aBrand;
/** /**
* @var ObjectCollection|ChildProductCategory[] Collection to store aggregation of ChildProductCategory objects. * @var ObjectCollection|ChildProductCategory[] Collection to store aggregation of ChildProductCategory objects.
*/ */
@@ -695,6 +708,17 @@ abstract class Product implements ActiveRecordInterface
return $this->template_id; return $this->template_id;
} }
/**
* Get the [brand_id] column value.
*
* @return int
*/
public function getBrandId()
{
return $this->brand_id;
}
/** /**
* Get the [optionally formatted] temporal [created_at] column value. * Get the [optionally formatted] temporal [created_at] column value.
* *
@@ -911,6 +935,31 @@ abstract class Product implements ActiveRecordInterface
return $this; return $this;
} // setTemplateId() } // setTemplateId()
/**
* Set the value of [brand_id] column.
*
* @param int $v new value
* @return \Thelia\Model\Product The current object (for fluent API support)
*/
public function setBrandId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->brand_id !== $v) {
$this->brand_id = $v;
$this->modifiedColumns[ProductTableMap::BRAND_ID] = true;
}
if ($this->aBrand !== null && $this->aBrand->getId() !== $v) {
$this->aBrand = null;
}
return $this;
} // setBrandId()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
* *
@@ -1083,28 +1132,31 @@ abstract class Product implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
$this->template_id = (null !== $col) ? (int) $col : null; $this->template_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductTableMap::translateFieldName('BrandId', TableMap::TYPE_PHPNAME, $indexType)];
$this->brand_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null; $this->version = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : ProductTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$this->version_created_by = (null !== $col) ? (string) $col : null; $this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified(); $this->resetModified();
@@ -1114,7 +1166,7 @@ abstract class Product implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 11; // 11 = ProductTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 12; // 12 = ProductTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Product object", 0, $e); throw new PropelException("Error populating \Thelia\Model\Product object", 0, $e);
@@ -1142,6 +1194,9 @@ abstract class Product implements ActiveRecordInterface
if ($this->aTemplate !== null && $this->template_id !== $this->aTemplate->getId()) { if ($this->aTemplate !== null && $this->template_id !== $this->aTemplate->getId()) {
$this->aTemplate = null; $this->aTemplate = null;
} }
if ($this->aBrand !== null && $this->brand_id !== $this->aBrand->getId()) {
$this->aBrand = null;
}
} // ensureConsistency } // ensureConsistency
/** /**
@@ -1183,6 +1238,7 @@ abstract class Product implements ActiveRecordInterface
$this->aTaxRule = null; $this->aTaxRule = null;
$this->aTemplate = null; $this->aTemplate = null;
$this->aBrand = null;
$this->collProductCategories = null; $this->collProductCategories = null;
$this->collFeatureProducts = null; $this->collFeatureProducts = null;
@@ -1361,6 +1417,13 @@ abstract class Product implements ActiveRecordInterface
$this->setTemplate($this->aTemplate); $this->setTemplate($this->aTemplate);
} }
if ($this->aBrand !== null) {
if ($this->aBrand->isModified() || $this->aBrand->isNew()) {
$affectedRows += $this->aBrand->save($con);
}
$this->setBrand($this->aBrand);
}
if ($this->isNew() || $this->isModified()) { if ($this->isNew() || $this->isModified()) {
// persist changes // persist changes
if ($this->isNew()) { if ($this->isNew()) {
@@ -1684,6 +1747,9 @@ abstract class Product implements ActiveRecordInterface
if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) { if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) {
$modifiedColumns[':p' . $index++] = '`TEMPLATE_ID`'; $modifiedColumns[':p' . $index++] = '`TEMPLATE_ID`';
} }
if ($this->isColumnModified(ProductTableMap::BRAND_ID)) {
$modifiedColumns[':p' . $index++] = '`BRAND_ID`';
}
if ($this->isColumnModified(ProductTableMap::CREATED_AT)) { if ($this->isColumnModified(ProductTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = '`CREATED_AT`'; $modifiedColumns[':p' . $index++] = '`CREATED_AT`';
} }
@@ -1728,6 +1794,9 @@ abstract class Product implements ActiveRecordInterface
case '`TEMPLATE_ID`': case '`TEMPLATE_ID`':
$stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
break; break;
case '`BRAND_ID`':
$stmt->bindValue($identifier, $this->brand_id, PDO::PARAM_INT);
break;
case '`CREATED_AT`': case '`CREATED_AT`':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break; break;
@@ -1824,18 +1893,21 @@ abstract class Product implements ActiveRecordInterface
return $this->getTemplateId(); return $this->getTemplateId();
break; break;
case 6: case 6:
return $this->getCreatedAt(); return $this->getBrandId();
break; break;
case 7: case 7:
return $this->getUpdatedAt(); return $this->getCreatedAt();
break; break;
case 8: case 8:
return $this->getVersion(); return $this->getUpdatedAt();
break; break;
case 9: case 9:
return $this->getVersionCreatedAt(); return $this->getVersion();
break; break;
case 10: case 10:
return $this->getVersionCreatedAt();
break;
case 11:
return $this->getVersionCreatedBy(); return $this->getVersionCreatedBy();
break; break;
default: default:
@@ -1873,11 +1945,12 @@ abstract class Product implements ActiveRecordInterface
$keys[3] => $this->getVisible(), $keys[3] => $this->getVisible(),
$keys[4] => $this->getPosition(), $keys[4] => $this->getPosition(),
$keys[5] => $this->getTemplateId(), $keys[5] => $this->getTemplateId(),
$keys[6] => $this->getCreatedAt(), $keys[6] => $this->getBrandId(),
$keys[7] => $this->getUpdatedAt(), $keys[7] => $this->getCreatedAt(),
$keys[8] => $this->getVersion(), $keys[8] => $this->getUpdatedAt(),
$keys[9] => $this->getVersionCreatedAt(), $keys[9] => $this->getVersion(),
$keys[10] => $this->getVersionCreatedBy(), $keys[10] => $this->getVersionCreatedAt(),
$keys[11] => $this->getVersionCreatedBy(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1891,6 +1964,9 @@ abstract class Product implements ActiveRecordInterface
if (null !== $this->aTemplate) { if (null !== $this->aTemplate) {
$result['Template'] = $this->aTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); $result['Template'] = $this->aTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
} }
if (null !== $this->aBrand) {
$result['Brand'] = $this->aBrand->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->collProductCategories) { if (null !== $this->collProductCategories) {
$result['ProductCategories'] = $this->collProductCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['ProductCategories'] = $this->collProductCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
@@ -1977,18 +2053,21 @@ abstract class Product implements ActiveRecordInterface
$this->setTemplateId($value); $this->setTemplateId($value);
break; break;
case 6: case 6:
$this->setCreatedAt($value); $this->setBrandId($value);
break; break;
case 7: case 7:
$this->setUpdatedAt($value); $this->setCreatedAt($value);
break; break;
case 8: case 8:
$this->setVersion($value); $this->setUpdatedAt($value);
break; break;
case 9: case 9:
$this->setVersionCreatedAt($value); $this->setVersion($value);
break; break;
case 10: case 10:
$this->setVersionCreatedAt($value);
break;
case 11:
$this->setVersionCreatedBy($value); $this->setVersionCreatedBy($value);
break; break;
} // switch() } // switch()
@@ -2021,11 +2100,12 @@ abstract class Product implements ActiveRecordInterface
if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setTemplateId($arr[$keys[5]]); if (array_key_exists($keys[5], $arr)) $this->setTemplateId($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); if (array_key_exists($keys[6], $arr)) $this->setBrandId($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]); if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]); if (array_key_exists($keys[9], $arr)) $this->setVersion($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]); if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedAt($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setVersionCreatedBy($arr[$keys[11]]);
} }
/** /**
@@ -2043,6 +2123,7 @@ abstract class Product implements ActiveRecordInterface
if ($this->isColumnModified(ProductTableMap::VISIBLE)) $criteria->add(ProductTableMap::VISIBLE, $this->visible); if ($this->isColumnModified(ProductTableMap::VISIBLE)) $criteria->add(ProductTableMap::VISIBLE, $this->visible);
if ($this->isColumnModified(ProductTableMap::POSITION)) $criteria->add(ProductTableMap::POSITION, $this->position); if ($this->isColumnModified(ProductTableMap::POSITION)) $criteria->add(ProductTableMap::POSITION, $this->position);
if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) $criteria->add(ProductTableMap::TEMPLATE_ID, $this->template_id); if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) $criteria->add(ProductTableMap::TEMPLATE_ID, $this->template_id);
if ($this->isColumnModified(ProductTableMap::BRAND_ID)) $criteria->add(ProductTableMap::BRAND_ID, $this->brand_id);
if ($this->isColumnModified(ProductTableMap::CREATED_AT)) $criteria->add(ProductTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(ProductTableMap::CREATED_AT)) $criteria->add(ProductTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductTableMap::UPDATED_AT)) $criteria->add(ProductTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(ProductTableMap::UPDATED_AT)) $criteria->add(ProductTableMap::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(ProductTableMap::VERSION)) $criteria->add(ProductTableMap::VERSION, $this->version); if ($this->isColumnModified(ProductTableMap::VERSION)) $criteria->add(ProductTableMap::VERSION, $this->version);
@@ -2116,6 +2197,7 @@ abstract class Product implements ActiveRecordInterface
$copyObj->setVisible($this->getVisible()); $copyObj->setVisible($this->getVisible());
$copyObj->setPosition($this->getPosition()); $copyObj->setPosition($this->getPosition());
$copyObj->setTemplateId($this->getTemplateId()); $copyObj->setTemplateId($this->getTemplateId());
$copyObj->setBrandId($this->getBrandId());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion()); $copyObj->setVersion($this->getVersion());
@@ -2325,6 +2407,57 @@ abstract class Product implements ActiveRecordInterface
return $this->aTemplate; return $this->aTemplate;
} }
/**
* Declares an association between this object and a ChildBrand object.
*
* @param ChildBrand $v
* @return \Thelia\Model\Product The current object (for fluent API support)
* @throws PropelException
*/
public function setBrand(ChildBrand $v = null)
{
if ($v === null) {
$this->setBrandId(NULL);
} else {
$this->setBrandId($v->getId());
}
$this->aBrand = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildBrand object, it will not be re-added.
if ($v !== null) {
$v->addProduct($this);
}
return $this;
}
/**
* Get the associated ChildBrand object
*
* @param ConnectionInterface $con Optional Connection object.
* @return ChildBrand The associated ChildBrand object.
* @throws PropelException
*/
public function getBrand(ConnectionInterface $con = null)
{
if ($this->aBrand === null && ($this->brand_id !== null)) {
$this->aBrand = ChildBrandQuery::create()->findPk($this->brand_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aBrand->addProducts($this);
*/
}
return $this->aBrand;
}
/** /**
* Initializes a collection based on the name of a relation. * Initializes a collection based on the name of a relation.
@@ -5492,6 +5625,7 @@ abstract class Product implements ActiveRecordInterface
$this->visible = null; $this->visible = null;
$this->position = null; $this->position = null;
$this->template_id = null; $this->template_id = null;
$this->brand_id = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->version = null; $this->version = null;
@@ -5609,6 +5743,7 @@ abstract class Product implements ActiveRecordInterface
$this->collProductsRelatedByProductId = null; $this->collProductsRelatedByProductId = null;
$this->aTaxRule = null; $this->aTaxRule = null;
$this->aTemplate = null; $this->aTemplate = null;
$this->aBrand = null;
} }
/** /**
@@ -5956,6 +6091,7 @@ abstract class Product implements ActiveRecordInterface
$version->setVisible($this->getVisible()); $version->setVisible($this->getVisible());
$version->setPosition($this->getPosition()); $version->setPosition($this->getPosition());
$version->setTemplateId($this->getTemplateId()); $version->setTemplateId($this->getTemplateId());
$version->setBrandId($this->getBrandId());
$version->setCreatedAt($this->getCreatedAt()); $version->setCreatedAt($this->getCreatedAt());
$version->setUpdatedAt($this->getUpdatedAt()); $version->setUpdatedAt($this->getUpdatedAt());
$version->setVersion($this->getVersion()); $version->setVersion($this->getVersion());
@@ -6004,6 +6140,7 @@ abstract class Product implements ActiveRecordInterface
$this->setVisible($version->getVisible()); $this->setVisible($version->getVisible());
$this->setPosition($version->getPosition()); $this->setPosition($version->getPosition());
$this->setTemplateId($version->getTemplateId()); $this->setTemplateId($version->getTemplateId());
$this->setBrandId($version->getBrandId());
$this->setCreatedAt($version->getCreatedAt()); $this->setCreatedAt($version->getCreatedAt());
$this->setUpdatedAt($version->getUpdatedAt()); $this->setUpdatedAt($version->getUpdatedAt());
$this->setVersion($version->getVersion()); $this->setVersion($version->getVersion());

View File

@@ -28,6 +28,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery orderByVisible($order = Criteria::ASC) Order by the visible column * @method ChildProductQuery orderByVisible($order = Criteria::ASC) Order by the visible column
* @method ChildProductQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildProductQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildProductQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column * @method ChildProductQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
* @method ChildProductQuery orderByBrandId($order = Criteria::ASC) Order by the brand_id column
* @method ChildProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildProductQuery orderByVersion($order = Criteria::ASC) Order by the version column * @method ChildProductQuery orderByVersion($order = Criteria::ASC) Order by the version column
@@ -40,6 +41,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery groupByVisible() Group by the visible column * @method ChildProductQuery groupByVisible() Group by the visible column
* @method ChildProductQuery groupByPosition() Group by the position column * @method ChildProductQuery groupByPosition() Group by the position column
* @method ChildProductQuery groupByTemplateId() Group by the template_id column * @method ChildProductQuery groupByTemplateId() Group by the template_id column
* @method ChildProductQuery groupByBrandId() Group by the brand_id column
* @method ChildProductQuery groupByCreatedAt() Group by the created_at column * @method ChildProductQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductQuery groupByUpdatedAt() Group by the updated_at column * @method ChildProductQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildProductQuery groupByVersion() Group by the version column * @method ChildProductQuery groupByVersion() Group by the version column
@@ -58,6 +60,10 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation * @method ChildProductQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
* @method ChildProductQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation * @method ChildProductQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
* *
* @method ChildProductQuery leftJoinBrand($relationAlias = null) Adds a LEFT JOIN clause to the query using the Brand relation
* @method ChildProductQuery rightJoinBrand($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Brand relation
* @method ChildProductQuery innerJoinBrand($relationAlias = null) Adds a INNER JOIN clause to the query using the Brand relation
*
* @method ChildProductQuery leftJoinProductCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductCategory relation * @method ChildProductQuery leftJoinProductCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductCategory relation
* @method ChildProductQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation * @method ChildProductQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation
* @method ChildProductQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation * @method ChildProductQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
@@ -111,6 +117,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProduct findOneByVisible(int $visible) Return the first ChildProduct filtered by the visible column * @method ChildProduct findOneByVisible(int $visible) Return the first ChildProduct filtered by the visible column
* @method ChildProduct findOneByPosition(int $position) Return the first ChildProduct filtered by the position column * @method ChildProduct findOneByPosition(int $position) Return the first ChildProduct filtered by the position column
* @method ChildProduct findOneByTemplateId(int $template_id) Return the first ChildProduct filtered by the template_id column * @method ChildProduct findOneByTemplateId(int $template_id) Return the first ChildProduct filtered by the template_id column
* @method ChildProduct findOneByBrandId(int $brand_id) Return the first ChildProduct filtered by the brand_id column
* @method ChildProduct findOneByCreatedAt(string $created_at) Return the first ChildProduct filtered by the created_at column * @method ChildProduct findOneByCreatedAt(string $created_at) Return the first ChildProduct filtered by the created_at column
* @method ChildProduct findOneByUpdatedAt(string $updated_at) Return the first ChildProduct filtered by the updated_at column * @method ChildProduct findOneByUpdatedAt(string $updated_at) Return the first ChildProduct filtered by the updated_at column
* @method ChildProduct findOneByVersion(int $version) Return the first ChildProduct filtered by the version column * @method ChildProduct findOneByVersion(int $version) Return the first ChildProduct filtered by the version column
@@ -123,6 +130,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method array findByVisible(int $visible) Return ChildProduct objects filtered by the visible column * @method array findByVisible(int $visible) Return ChildProduct objects filtered by the visible column
* @method array findByPosition(int $position) Return ChildProduct objects filtered by the position column * @method array findByPosition(int $position) Return ChildProduct objects filtered by the position column
* @method array findByTemplateId(int $template_id) Return ChildProduct objects filtered by the template_id column * @method array findByTemplateId(int $template_id) Return ChildProduct objects filtered by the template_id column
* @method array findByBrandId(int $brand_id) Return ChildProduct objects filtered by the brand_id column
* @method array findByCreatedAt(string $created_at) Return ChildProduct objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildProduct objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProduct objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildProduct objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildProduct objects filtered by the version column * @method array findByVersion(int $version) Return ChildProduct objects filtered by the version column
@@ -223,7 +231,7 @@ abstract class ProductQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product` WHERE `ID` = :p0'; $sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `BRAND_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product` WHERE `ID` = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -550,6 +558,49 @@ abstract class ProductQuery extends ModelCriteria
return $this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId, $comparison); return $this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId, $comparison);
} }
/**
* Filter the query on the brand_id column
*
* Example usage:
* <code>
* $query->filterByBrandId(1234); // WHERE brand_id = 1234
* $query->filterByBrandId(array(12, 34)); // WHERE brand_id IN (12, 34)
* $query->filterByBrandId(array('min' => 12)); // WHERE brand_id > 12
* </code>
*
* @see filterByBrand()
*
* @param mixed $brandId 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 ChildProductQuery The current query, for fluid interface
*/
public function filterByBrandId($brandId = null, $comparison = null)
{
if (is_array($brandId)) {
$useMinMax = false;
if (isset($brandId['min'])) {
$this->addUsingAlias(ProductTableMap::BRAND_ID, $brandId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($brandId['max'])) {
$this->addUsingAlias(ProductTableMap::BRAND_ID, $brandId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProductTableMap::BRAND_ID, $brandId, $comparison);
}
/** /**
* Filter the query on the created_at column * Filter the query on the created_at column
* *
@@ -899,6 +950,81 @@ abstract class ProductQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery'); ->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
} }
/**
* Filter the query by a related \Thelia\Model\Brand object
*
* @param \Thelia\Model\Brand|ObjectCollection $brand The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildProductQuery The current query, for fluid interface
*/
public function filterByBrand($brand, $comparison = null)
{
if ($brand instanceof \Thelia\Model\Brand) {
return $this
->addUsingAlias(ProductTableMap::BRAND_ID, $brand->getId(), $comparison);
} elseif ($brand instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ProductTableMap::BRAND_ID, $brand->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByBrand() only accepts arguments of type \Thelia\Model\Brand or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Brand relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildProductQuery The current query, for fluid interface
*/
public function joinBrand($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Brand');
// 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, 'Brand');
}
return $this;
}
/**
* Use the Brand relation Brand 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\BrandQuery A secondary query class using the current class as primary query
*/
public function useBrandQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinBrand($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Brand', '\Thelia\Model\BrandQuery');
}
/** /**
* Filter the query by a related \Thelia\Model\ProductCategory object * Filter the query by a related \Thelia\Model\ProductCategory object
* *

View File

@@ -93,6 +93,12 @@ abstract class ProductVersion implements ActiveRecordInterface
*/ */
protected $template_id; protected $template_id;
/**
* The value for the brand_id field.
* @var int
*/
protected $brand_id;
/** /**
* The value for the created_at field. * The value for the created_at field.
* @var string * @var string
@@ -476,6 +482,17 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this->template_id; return $this->template_id;
} }
/**
* Get the [brand_id] column value.
*
* @return int
*/
public function getBrandId()
{
return $this->brand_id;
}
/** /**
* Get the [optionally formatted] temporal [created_at] column value. * Get the [optionally formatted] temporal [created_at] column value.
* *
@@ -688,6 +705,27 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this; return $this;
} // setTemplateId() } // setTemplateId()
/**
* Set the value of [brand_id] column.
*
* @param int $v new value
* @return \Thelia\Model\ProductVersion The current object (for fluent API support)
*/
public function setBrandId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->brand_id !== $v) {
$this->brand_id = $v;
$this->modifiedColumns[ProductVersionTableMap::BRAND_ID] = true;
}
return $this;
} // setBrandId()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
* *
@@ -860,28 +898,31 @@ abstract class ProductVersion implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductVersionTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductVersionTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
$this->template_id = (null !== $col) ? (int) $col : null; $this->template_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductVersionTableMap::translateFieldName('BrandId', TableMap::TYPE_PHPNAME, $indexType)];
$this->brand_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null; $this->version = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$this->version_created_by = (null !== $col) ? (string) $col : null; $this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified(); $this->resetModified();
@@ -891,7 +932,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 11; // 11 = ProductVersionTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 12; // 12 = ProductVersionTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductVersion object", 0, $e); throw new PropelException("Error populating \Thelia\Model\ProductVersion object", 0, $e);
@@ -1130,6 +1171,9 @@ abstract class ProductVersion implements ActiveRecordInterface
if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) { if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) {
$modifiedColumns[':p' . $index++] = '`TEMPLATE_ID`'; $modifiedColumns[':p' . $index++] = '`TEMPLATE_ID`';
} }
if ($this->isColumnModified(ProductVersionTableMap::BRAND_ID)) {
$modifiedColumns[':p' . $index++] = '`BRAND_ID`';
}
if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) { if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = '`CREATED_AT`'; $modifiedColumns[':p' . $index++] = '`CREATED_AT`';
} }
@@ -1174,6 +1218,9 @@ abstract class ProductVersion implements ActiveRecordInterface
case '`TEMPLATE_ID`': case '`TEMPLATE_ID`':
$stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
break; break;
case '`BRAND_ID`':
$stmt->bindValue($identifier, $this->brand_id, PDO::PARAM_INT);
break;
case '`CREATED_AT`': case '`CREATED_AT`':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break; break;
@@ -1263,18 +1310,21 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this->getTemplateId(); return $this->getTemplateId();
break; break;
case 6: case 6:
return $this->getCreatedAt(); return $this->getBrandId();
break; break;
case 7: case 7:
return $this->getUpdatedAt(); return $this->getCreatedAt();
break; break;
case 8: case 8:
return $this->getVersion(); return $this->getUpdatedAt();
break; break;
case 9: case 9:
return $this->getVersionCreatedAt(); return $this->getVersion();
break; break;
case 10: case 10:
return $this->getVersionCreatedAt();
break;
case 11:
return $this->getVersionCreatedBy(); return $this->getVersionCreatedBy();
break; break;
default: default:
@@ -1312,11 +1362,12 @@ abstract class ProductVersion implements ActiveRecordInterface
$keys[3] => $this->getVisible(), $keys[3] => $this->getVisible(),
$keys[4] => $this->getPosition(), $keys[4] => $this->getPosition(),
$keys[5] => $this->getTemplateId(), $keys[5] => $this->getTemplateId(),
$keys[6] => $this->getCreatedAt(), $keys[6] => $this->getBrandId(),
$keys[7] => $this->getUpdatedAt(), $keys[7] => $this->getCreatedAt(),
$keys[8] => $this->getVersion(), $keys[8] => $this->getUpdatedAt(),
$keys[9] => $this->getVersionCreatedAt(), $keys[9] => $this->getVersion(),
$keys[10] => $this->getVersionCreatedBy(), $keys[10] => $this->getVersionCreatedAt(),
$keys[11] => $this->getVersionCreatedBy(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1380,18 +1431,21 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->setTemplateId($value); $this->setTemplateId($value);
break; break;
case 6: case 6:
$this->setCreatedAt($value); $this->setBrandId($value);
break; break;
case 7: case 7:
$this->setUpdatedAt($value); $this->setCreatedAt($value);
break; break;
case 8: case 8:
$this->setVersion($value); $this->setUpdatedAt($value);
break; break;
case 9: case 9:
$this->setVersionCreatedAt($value); $this->setVersion($value);
break; break;
case 10: case 10:
$this->setVersionCreatedAt($value);
break;
case 11:
$this->setVersionCreatedBy($value); $this->setVersionCreatedBy($value);
break; break;
} // switch() } // switch()
@@ -1424,11 +1478,12 @@ abstract class ProductVersion implements ActiveRecordInterface
if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setTemplateId($arr[$keys[5]]); if (array_key_exists($keys[5], $arr)) $this->setTemplateId($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); if (array_key_exists($keys[6], $arr)) $this->setBrandId($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]); if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]); if (array_key_exists($keys[9], $arr)) $this->setVersion($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]); if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedAt($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setVersionCreatedBy($arr[$keys[11]]);
} }
/** /**
@@ -1446,6 +1501,7 @@ abstract class ProductVersion implements ActiveRecordInterface
if ($this->isColumnModified(ProductVersionTableMap::VISIBLE)) $criteria->add(ProductVersionTableMap::VISIBLE, $this->visible); if ($this->isColumnModified(ProductVersionTableMap::VISIBLE)) $criteria->add(ProductVersionTableMap::VISIBLE, $this->visible);
if ($this->isColumnModified(ProductVersionTableMap::POSITION)) $criteria->add(ProductVersionTableMap::POSITION, $this->position); if ($this->isColumnModified(ProductVersionTableMap::POSITION)) $criteria->add(ProductVersionTableMap::POSITION, $this->position);
if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) $criteria->add(ProductVersionTableMap::TEMPLATE_ID, $this->template_id); if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) $criteria->add(ProductVersionTableMap::TEMPLATE_ID, $this->template_id);
if ($this->isColumnModified(ProductVersionTableMap::BRAND_ID)) $criteria->add(ProductVersionTableMap::BRAND_ID, $this->brand_id);
if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) $criteria->add(ProductVersionTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) $criteria->add(ProductVersionTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductVersionTableMap::UPDATED_AT)) $criteria->add(ProductVersionTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(ProductVersionTableMap::UPDATED_AT)) $criteria->add(ProductVersionTableMap::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(ProductVersionTableMap::VERSION)) $criteria->add(ProductVersionTableMap::VERSION, $this->version); if ($this->isColumnModified(ProductVersionTableMap::VERSION)) $criteria->add(ProductVersionTableMap::VERSION, $this->version);
@@ -1527,6 +1583,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$copyObj->setVisible($this->getVisible()); $copyObj->setVisible($this->getVisible());
$copyObj->setPosition($this->getPosition()); $copyObj->setPosition($this->getPosition());
$copyObj->setTemplateId($this->getTemplateId()); $copyObj->setTemplateId($this->getTemplateId());
$copyObj->setBrandId($this->getBrandId());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion()); $copyObj->setVersion($this->getVersion());
@@ -1621,6 +1678,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->visible = null; $this->visible = null;
$this->position = null; $this->position = null;
$this->template_id = null; $this->template_id = null;
$this->brand_id = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->version = null; $this->version = null;

View File

@@ -27,6 +27,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column * @method ChildProductVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column
* @method ChildProductVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildProductVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildProductVersionQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column * @method ChildProductVersionQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
* @method ChildProductVersionQuery orderByBrandId($order = Criteria::ASC) Order by the brand_id column
* @method ChildProductVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildProductVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildProductVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildProductVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column * @method ChildProductVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
@@ -39,6 +40,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersionQuery groupByVisible() Group by the visible column * @method ChildProductVersionQuery groupByVisible() Group by the visible column
* @method ChildProductVersionQuery groupByPosition() Group by the position column * @method ChildProductVersionQuery groupByPosition() Group by the position column
* @method ChildProductVersionQuery groupByTemplateId() Group by the template_id column * @method ChildProductVersionQuery groupByTemplateId() Group by the template_id column
* @method ChildProductVersionQuery groupByBrandId() Group by the brand_id column
* @method ChildProductVersionQuery groupByCreatedAt() Group by the created_at column * @method ChildProductVersionQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductVersionQuery groupByUpdatedAt() Group by the updated_at column * @method ChildProductVersionQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildProductVersionQuery groupByVersion() Group by the version column * @method ChildProductVersionQuery groupByVersion() Group by the version column
@@ -62,6 +64,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersion findOneByVisible(int $visible) Return the first ChildProductVersion filtered by the visible column * @method ChildProductVersion findOneByVisible(int $visible) Return the first ChildProductVersion filtered by the visible column
* @method ChildProductVersion findOneByPosition(int $position) Return the first ChildProductVersion filtered by the position column * @method ChildProductVersion findOneByPosition(int $position) Return the first ChildProductVersion filtered by the position column
* @method ChildProductVersion findOneByTemplateId(int $template_id) Return the first ChildProductVersion filtered by the template_id column * @method ChildProductVersion findOneByTemplateId(int $template_id) Return the first ChildProductVersion filtered by the template_id column
* @method ChildProductVersion findOneByBrandId(int $brand_id) Return the first ChildProductVersion filtered by the brand_id column
* @method ChildProductVersion findOneByCreatedAt(string $created_at) Return the first ChildProductVersion filtered by the created_at column * @method ChildProductVersion findOneByCreatedAt(string $created_at) Return the first ChildProductVersion filtered by the created_at column
* @method ChildProductVersion findOneByUpdatedAt(string $updated_at) Return the first ChildProductVersion filtered by the updated_at column * @method ChildProductVersion findOneByUpdatedAt(string $updated_at) Return the first ChildProductVersion filtered by the updated_at column
* @method ChildProductVersion findOneByVersion(int $version) Return the first ChildProductVersion filtered by the version column * @method ChildProductVersion findOneByVersion(int $version) Return the first ChildProductVersion filtered by the version column
@@ -74,6 +77,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method array findByVisible(int $visible) Return ChildProductVersion objects filtered by the visible column * @method array findByVisible(int $visible) Return ChildProductVersion objects filtered by the visible column
* @method array findByPosition(int $position) Return ChildProductVersion objects filtered by the position column * @method array findByPosition(int $position) Return ChildProductVersion objects filtered by the position column
* @method array findByTemplateId(int $template_id) Return ChildProductVersion objects filtered by the template_id column * @method array findByTemplateId(int $template_id) Return ChildProductVersion objects filtered by the template_id column
* @method array findByBrandId(int $brand_id) Return ChildProductVersion objects filtered by the brand_id column
* @method array findByCreatedAt(string $created_at) Return ChildProductVersion objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildProductVersion objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProductVersion objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildProductVersion objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildProductVersion objects filtered by the version column * @method array findByVersion(int $version) Return ChildProductVersion objects filtered by the version column
@@ -167,7 +171,7 @@ abstract class ProductVersionQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product_version` WHERE `ID` = :p0 AND `VERSION` = :p1'; $sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `BRAND_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -504,6 +508,47 @@ abstract class ProductVersionQuery extends ModelCriteria
return $this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId, $comparison); return $this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId, $comparison);
} }
/**
* Filter the query on the brand_id column
*
* Example usage:
* <code>
* $query->filterByBrandId(1234); // WHERE brand_id = 1234
* $query->filterByBrandId(array(12, 34)); // WHERE brand_id IN (12, 34)
* $query->filterByBrandId(array('min' => 12)); // WHERE brand_id > 12
* </code>
*
* @param mixed $brandId 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 ChildProductVersionQuery The current query, for fluid interface
*/
public function filterByBrandId($brandId = null, $comparison = null)
{
if (is_array($brandId)) {
$useMinMax = false;
if (isset($brandId['min'])) {
$this->addUsingAlias(ProductVersionTableMap::BRAND_ID, $brandId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($brandId['max'])) {
$this->addUsingAlias(ProductVersionTableMap::BRAND_ID, $brandId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProductVersionTableMap::BRAND_ID, $brandId, $comparison);
}
/** /**
* Filter the query on the created_at column * Filter the query on the created_at column
* *

View File

@@ -1545,6 +1545,31 @@ abstract class TaxRule implements ActiveRecordInterface
return $this->getProducts($query, $con); return $this->getProducts($query, $con);
} }
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this TaxRule is new, it will return
* an empty collection; or if this TaxRule has previously
* been saved, it will retrieve related Products from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in TaxRule.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildProduct[] List of ChildProduct objects
*/
public function getProductsJoinBrand($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildProductQuery::create(null, $criteria);
$query->joinWith('Brand', $joinBehavior);
return $this->getProducts($query, $con);
}
/** /**
* Clears out the collTaxRuleCountries collection * Clears out the collTaxRuleCountries collection
* *

View File

@@ -1589,6 +1589,31 @@ abstract class Template implements ActiveRecordInterface
return $this->getProducts($query, $con); return $this->getProducts($query, $con);
} }
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Template is new, it will return
* an empty collection; or if this Template has previously
* been saved, it will retrieve related Products from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Template.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return Collection|ChildProduct[] List of ChildProduct objects
*/
public function getProductsJoinBrand($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildProductQuery::create(null, $criteria);
$query->joinWith('Brand', $joinBehavior);
return $this->getProducts($query, $con);
}
/** /**
* Clears out the collFeatureTemplates collection * Clears out the collFeatureTemplates collection
* *

View File

@@ -0,0 +1,88 @@
<?php
namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Event\Brand\BrandEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Files\FileModelParentInterface;
use Thelia\Model\Base\Brand as BaseBrand;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Model\Tools\PositionManagementTrait;
use Thelia\Model\Tools\UrlRewritingTrait;
class Brand extends BaseBrand implements FileModelParentInterface
{
use ModelEventDispatcherTrait;
use PositionManagementTrait;
use UrlRewritingTrait;
/**
* {@inheritDoc}
*/
protected function getRewrittenUrlViewName()
{
return 'brand';
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEBRAND, new BrandEvent($this));
// Set the current position for the new object
$this->setPosition($this->getNextPosition());
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_CREATEBRAND, new BrandEvent($this));
}
/**
* {@inheritDoc}
*/
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATEBRAND, new BrandEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_UPDATEBRAND, new BrandEvent($this));
}
/**
* {@inheritDoc}
*/
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_DELETEBRAND, new BrandEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postDelete(ConnectionInterface $con = null)
{
$this->markRewritenUrlObsolete();
$this->dispatchEvent(TheliaEvents::AFTER_DELETEBRAND, new BrandEvent($this));
}
}

View File

@@ -0,0 +1,130 @@
<?php
namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Files\FileModelInterface;
use Thelia\Files\FileModelParentInterface;
use Thelia\Form\BaseForm;
use Thelia\Form\Brand\BrandDocumentModification;
use Thelia\Model\Base\BrandDocument as BaseBrandDocument;
use Thelia\Model\Breadcrumb\BrandBreadcrumbTrait;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Model\Tools\PositionManagementTrait;
class BrandDocument extends BaseBrandDocument implements BreadcrumbInterface, FileModelInterface
{
use ModelEventDispatcherTrait;
use PositionManagementTrait;
use BrandBreadcrumbTrait;
/**
* Calculate next position relative to our parent
*
* @param BrandDocumentQuery $query
*/
protected function addCriteriaToPositionQuery($query)
{
$query->filterByBrandId($this->getBrandId());
}
/**
* @inheritDoc
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
return true;
}
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"brand_id" => $this->getBrandId(),
)
);
return true;
}
/**
* @inheritDoc
*/
public function setParentId($parentId)
{
$this->setBrandId($parentId);
return $this;
}
/**
* @inheritDoc
*/
public function getParentId()
{
return $this->getBrandId();
}
/**
* @return FileModelParentInterface the parent file model
*/
public function getParentFileModel()
{
return new Brand();
}
/**
* Get the ID of the form used to change this object information
*
* @return BaseForm the form
*/
public function getUpdateFormId()
{
return 'thelia.admin.brand.document.modification';
}
/**
* Get the form instance used to change this object information
*
* @param \Thelia\Core\HttpFoundation\Request $request
*
* @return BaseForm the form
*/
public function getUpdateFormInstance(Request $request)
{
return new BrandDocumentModification($request);
}
/**
* @return string the path to the upload directory where files are stored, without final slash
*/
public function getUploadDir()
{
return THELIA_LOCAL_DIR . 'media'.DS.'documents'.DS.'brand';
}
/**
* @param int $objectId the ID of the object
*
* @return string the URL to redirect to after update from the back-office
*/
public function getRedirectionUrl($objectId)
{
return '/admin/brand/update/' . $objectId . '?current_tab=document';
}
/**
* Get the Query instance for this object
*
* @return ModelCriteria
*/
public function getQueryInstance()
{
return BrandDocumentQuery::create();
}
}

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,16 @@
<?php
namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Base\BrandI18n as BaseBrandI18n;
class BrandI18n extends BaseBrandI18n
{
public function postInsert(ConnectionInterface $con = null)
{
$content = $this->getBrand();
$content->generateRewrittenUrl($this->getLocale());
}
}

View File

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

View File

@@ -0,0 +1,130 @@
<?php
namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Files\FileModelParentInterface;
use Thelia\Form\BaseForm;
use Thelia\Form\Brand\BrandImageModification;
use Thelia\Model\Base\BrandImage as BaseBrandImage;
use Thelia\Model\Breadcrumb\BrandBreadcrumbTrait;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Files\FileModelInterface;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Model\Tools\PositionManagementTrait;
class BrandImage extends BaseBrandImage implements FileModelInterface, BreadcrumbInterface
{
use ModelEventDispatcherTrait;
use PositionManagementTrait;
use BrandBreadcrumbTrait;
/**
* Calculate next position relative to our parent
*
* @param BrandImageQuery $query
*/
protected function addCriteriaToPositionQuery($query)
{
$query->filterByBrandId($this->getBrandId());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
return true;
}
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"brand_id" => $this->getBrandId(),
)
);
return true;
}
/**
* @inheritdoc
*/
public function setParentId($parentId)
{
$this->setBrandId($parentId);
return $this;
}
/**
* @inheritdoc
*/
public function getParentId()
{
return $this->getBrandId();
}
/**
* @return FileModelParentInterface the parent file model
*/
public function getParentFileModel()
{
return new Brand();
}
/**
* Get the ID of the form used to change this object information
*
* @return BaseForm the form
*/
public function getUpdateFormId()
{
return 'thelia.admin.brand.image.modification';
}
/**
* Get the form instance used to change this object information
*
* @param \Thelia\Core\HttpFoundation\Request $request
*
* @return BaseForm the form
*/
public function getUpdateFormInstance(Request $request)
{
return new BrandImageModification($request);
}
/**
* @return string the path to the upload directory where files are stored, without final slash
*/
public function getUploadDir()
{
return THELIA_LOCAL_DIR . 'media'.DS.'images'.DS.'brand';
}
/**
* @param int $objectId the ID of the object
*
* @return string the URL to redirect to after update from the back-office
*/
public function getRedirectionUrl($objectId)
{
return '/admin/brand/update/' . $objectId . '?current_tab=image';
}
/**
* Get the Query instance for this object
*
* @return ModelCriteria
*/
public function getQueryInstance()
{
return BrandImageQuery::create();
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,43 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Model\Breadcrumb;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\Translation\Translator;
use Thelia\Model\BrandQuery;
trait BrandBreadcrumbTrait
{
/**
* @inheritdoc
*/
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
$breadcrumb = [
Translator::getInstance()->trans('Home') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL),
Translator::getInstance()->trans('Brand') => $router->generate('admin.brand.default', [], Router::ABSOLUTE_URL)
];
if (null !== $brand = BrandQuery::create()->findPk($this->getBrandId())) {
$breadcrumb[$brand->setLocale($locale)->getTitle()] = sprintf(
"%s?current_tab=%s",
$router->generate('admin.brand.update', ['brand_id' => $brand->getId()], Router::ABSOLUTE_URL),
$tab
);
}
return $breadcrumb;
}
}

View File

@@ -19,10 +19,14 @@ interface BreadcrumbInterface
{ {
/** /**
* Create a breadcrumb from the current object, that will be displayed to the file management UI
* *
* return the complete breadcrumb for a given resource. * @param Router $router the router where to find routes
* @param ContainerInterface $container the container
* @param string $tab the tab to return to (probably 'image' or 'document')
* @param string $locale the current locale
* *
* @return array * @return array an array of (label => URL)
*/ */
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab); public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale);
} }

View File

@@ -17,17 +17,19 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router; use Symfony\Component\Routing\Router;
use Thelia\Core\Template\Loop\CategoryPath; use Thelia\Core\Template\Loop\CategoryPath;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
use Thelia\Model\Category;
use Thelia\Model\Product;
trait CatalogBreadcrumbTrait trait CatalogBreadcrumbTrait
{ {
public function getBaseBreadcrumb(Router $router, ContainerInterface $container, $categoryId, &$locale) public function getBaseBreadcrumb(Router $router, ContainerInterface $container, $categoryId)
{ {
$translator = Translator::getInstance(); $translator = Translator::getInstance();
$catalogUrl = $router->generate('admin.catalog', [], Router::ABSOLUTE_URL); $catalogUrl = $router->generate('admin.catalog', [], Router::ABSOLUTE_URL);
$breadcrumb = [ $breadcrumb = [
$translator->trans('Home', [], 'bo.default') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL), $translator->trans('Home') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL),
$translator->trans('Catalog', [], 'bo.default') => $catalogUrl, $translator->trans('Catalog') => $catalogUrl,
]; ];
$categoryPath = new CategoryPath($container); $categoryPath = new CategoryPath($container);
@@ -42,15 +44,13 @@ trait CatalogBreadcrumbTrait
$breadcrumb[$result['TITLE']] = sprintf("%s?category_id=%d",$catalogUrl, $result['ID']); $breadcrumb[$result['TITLE']] = sprintf("%s?category_id=%d",$catalogUrl, $result['ID']);
} }
$locale = $result['LOCALE'];
return $breadcrumb; return $breadcrumb;
} }
public function getProductBreadcrumb(Router $router, ContainerInterface $container, $tab) public function getProductBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{ {
/** @var Product $product */
$product = $this->getProduct(); $product = $this->getProduct();
$locale = null;
$breadcrumb = $this->getBaseBreadcrumb($router, $container, $product->getDefaultCategoryId(), $locale); $breadcrumb = $this->getBaseBreadcrumb($router, $container, $product->getDefaultCategoryId(), $locale);
@@ -65,11 +65,11 @@ trait CatalogBreadcrumbTrait
return $breadcrumb; return $breadcrumb;
} }
public function getCategoryBreadcrumb(Router $router, ContainerInterface $container, $tab) public function getCategoryBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{ {
$locale = null; /** @var Category $category */
$category = $this->getCategory(); $category = $this->getCategory();
$breadcrumb = $this->getBaseBreadcrumb($router, $container, $this->getParentId(), $locale); $breadcrumb = $this->getBaseBreadcrumb($router, $container, $this->getParentId());
$category->setLocale($locale); $category->setLocale($locale);

View File

@@ -17,17 +17,19 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router; use Symfony\Component\Routing\Router;
use Thelia\Core\Template\Loop\FolderPath; use Thelia\Core\Template\Loop\FolderPath;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
use Thelia\Model\Content;
use Thelia\Model\Folder;
trait FolderBreadcrumbTrait trait FolderBreadcrumbTrait
{ {
public function getBaseBreadcrumb(Router $router, ContainerInterface $container, $folderId, &$locale) public function getBaseBreadcrumb(Router $router, ContainerInterface $container, $folderId)
{ {
$translator = Translator::getInstance(); $translator = Translator::getInstance();
$catalogUrl = $router->generate('admin.catalog', [], Router::ABSOLUTE_URL); $catalogUrl = $router->generate('admin.catalog', [], Router::ABSOLUTE_URL);
$breadcrumb = [ $breadcrumb = [
$translator->trans('Home', [], 'bo.default') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL), $translator->trans('Home') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL),
$translator->trans('Folder', [], 'bo.default') => $catalogUrl, $translator->trans('Folder') => $catalogUrl,
]; ];
$folderPath = new FolderPath($container); $folderPath = new FolderPath($container);
@@ -45,16 +47,14 @@ trait FolderBreadcrumbTrait
); );
} }
$locale = $result['LOCALE'];
return $breadcrumb; return $breadcrumb;
} }
public function getFolderBreadcrumb($router, $container, $tab) public function getFolderBreadcrumb(Router $router, $container, $tab, $locale)
{ {
$locale = null; /** @var Folder $folder */
$folder = $this->getFolder(); $folder = $this->getFolder();
$breadcrumb = $this->getBaseBreadcrumb($router, $container, $this->getParentId(), $locale); $breadcrumb = $this->getBaseBreadcrumb($router, $container, $this->getParentId());
$folder->setLocale($locale); $folder->setLocale($locale);
@@ -66,12 +66,12 @@ trait FolderBreadcrumbTrait
return $breadcrumb; return $breadcrumb;
} }
public function getContentBreadcrumb(Router $router, ContainerInterface $container, $tab) public function getContentBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{ {
/** @var Content $content */
$content = $this->getContent(); $content = $this->getContent();
$locale = null;
$breadcrumb = $this->getBaseBreadcrumb($router, $container, $content->getDefaultFolderId(), $locale); $breadcrumb = $this->getBaseBreadcrumb($router, $container, $content->getDefaultFolderId());
$content->setLocale($locale); $content->setLocale($locale);

View File

@@ -0,0 +1,498 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\BrandDocumentI18n;
use Thelia\Model\BrandDocumentI18nQuery;
/**
* This class defines the structure of the 'brand_document_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 BrandDocumentI18nTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.BrandDocumentI18nTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'brand_document_i18n';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\BrandDocumentI18n';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.BrandDocumentI18n';
/**
* 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 = 'brand_document_i18n.ID';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'brand_document_i18n.LOCALE';
/**
* the column name for the TITLE field
*/
const TITLE = 'brand_document_i18n.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'brand_document_i18n.DESCRIPTION';
/**
* the column name for the CHAPO field
*/
const CHAPO = 'brand_document_i18n.CHAPO';
/**
* the column name for the POSTSCRIPTUM field
*/
const POSTSCRIPTUM = 'brand_document_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(BrandDocumentI18nTableMap::ID, BrandDocumentI18nTableMap::LOCALE, BrandDocumentI18nTableMap::TITLE, BrandDocumentI18nTableMap::DESCRIPTION, BrandDocumentI18nTableMap::CHAPO, BrandDocumentI18nTableMap::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(BrandDocumentI18nTableMap::ID => 0, BrandDocumentI18nTableMap::LOCALE => 1, BrandDocumentI18nTableMap::TITLE => 2, BrandDocumentI18nTableMap::DESCRIPTION => 3, BrandDocumentI18nTableMap::CHAPO => 4, BrandDocumentI18nTableMap::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('brand_document_i18n');
$this->setPhpName('BrandDocumentI18n');
$this->setClassName('\\Thelia\\Model\\BrandDocumentI18n');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'brand_document', '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('BrandDocument', '\\Thelia\\Model\\BrandDocument', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
} // buildRelations()
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by find*()
* and findPk*() calls.
*
* @param \Thelia\Model\BrandDocumentI18n $obj A \Thelia\Model\BrandDocumentI18n object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if (null === $key) {
$key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
} // if key === null
self::$instances[$key] = $obj;
}
}
/**
* Removes an object from the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doDelete
* methods in your stub classes -- you may need to explicitly remove objects
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A \Thelia\Model\BrandDocumentI18n object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Thelia\Model\BrandDocumentI18n) {
$key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
} elseif (is_array($value) && count($value) === 2) {
// assume we've been passed a primary key";
$key = serialize(array((string) $value[0], (string) $value[1]));
} elseif ($value instanceof Criteria) {
self::$instances = [];
return;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\BrandDocumentI18n 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 ? BrandDocumentI18nTableMap::CLASS_DEFAULT : BrandDocumentI18nTableMap::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 (BrandDocumentI18n object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = BrandDocumentI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = BrandDocumentI18nTableMap::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 + BrandDocumentI18nTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = BrandDocumentI18nTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
BrandDocumentI18nTableMap::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 = BrandDocumentI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = BrandDocumentI18nTableMap::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;
BrandDocumentI18nTableMap::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(BrandDocumentI18nTableMap::ID);
$criteria->addSelectColumn(BrandDocumentI18nTableMap::LOCALE);
$criteria->addSelectColumn(BrandDocumentI18nTableMap::TITLE);
$criteria->addSelectColumn(BrandDocumentI18nTableMap::DESCRIPTION);
$criteria->addSelectColumn(BrandDocumentI18nTableMap::CHAPO);
$criteria->addSelectColumn(BrandDocumentI18nTableMap::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(BrandDocumentI18nTableMap::DATABASE_NAME)->getTable(BrandDocumentI18nTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandDocumentI18nTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(BrandDocumentI18nTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new BrandDocumentI18nTableMap());
}
}
/**
* Performs a DELETE on the database, given a BrandDocumentI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or BrandDocumentI18n 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(BrandDocumentI18nTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\BrandDocumentI18n) { // 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(BrandDocumentI18nTableMap::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(BrandDocumentI18nTableMap::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(BrandDocumentI18nTableMap::LOCALE, $value[1]));
$criteria->addOr($criterion);
}
}
$query = BrandDocumentI18nQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { BrandDocumentI18nTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { BrandDocumentI18nTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the brand_document_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 BrandDocumentI18nQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a BrandDocumentI18n or Criteria object.
*
* @param mixed $criteria Criteria or BrandDocumentI18n 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(BrandDocumentI18nTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from BrandDocumentI18n object
}
// Set the correct dbName
$query = BrandDocumentI18nQuery::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;
}
} // BrandDocumentI18nTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BrandDocumentI18nTableMap::buildTableMap();

View File

@@ -0,0 +1,476 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\BrandDocument;
use Thelia\Model\BrandDocumentQuery;
/**
* This class defines the structure of the 'brand_document' 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 BrandDocumentTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.BrandDocumentTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'brand_document';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\BrandDocument';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.BrandDocument';
/**
* 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 = 'brand_document.ID';
/**
* the column name for the BRAND_ID field
*/
const BRAND_ID = 'brand_document.BRAND_ID';
/**
* the column name for the FILE field
*/
const FILE = 'brand_document.FILE';
/**
* the column name for the POSITION field
*/
const POSITION = 'brand_document.POSITION';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'brand_document.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'brand_document.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', 'BrandId', 'File', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'brandId', 'file', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(BrandDocumentTableMap::ID, BrandDocumentTableMap::BRAND_ID, BrandDocumentTableMap::FILE, BrandDocumentTableMap::POSITION, BrandDocumentTableMap::CREATED_AT, BrandDocumentTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'BRAND_ID', 'FILE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'brand_id', 'file', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'BrandId' => 1, 'File' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'brandId' => 1, 'file' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
self::TYPE_COLNAME => array(BrandDocumentTableMap::ID => 0, BrandDocumentTableMap::BRAND_ID => 1, BrandDocumentTableMap::FILE => 2, BrandDocumentTableMap::POSITION => 3, BrandDocumentTableMap::CREATED_AT => 4, BrandDocumentTableMap::UPDATED_AT => 5, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'BRAND_ID' => 1, 'FILE' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
self::TYPE_FIELDNAME => array('id' => 0, 'brand_id' => 1, 'file' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('brand_document');
$this->setPhpName('BrandDocument');
$this->setClassName('\\Thelia\\Model\\BrandDocument');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('BRAND_ID', 'BrandId', 'INTEGER', 'brand', 'ID', true, null, null);
$this->addColumn('FILE', 'File', 'VARCHAR', true, 255, 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('Brand', '\\Thelia\\Model\\Brand', RelationMap::MANY_TO_ONE, array('brand_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('BrandDocumentI18n', '\\Thelia\\Model\\BrandDocumentI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'BrandDocumentI18ns');
} // 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 brand_document * 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.
BrandDocumentI18nTableMap::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 ? BrandDocumentTableMap::CLASS_DEFAULT : BrandDocumentTableMap::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 (BrandDocument object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = BrandDocumentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = BrandDocumentTableMap::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 + BrandDocumentTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = BrandDocumentTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
BrandDocumentTableMap::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 = BrandDocumentTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = BrandDocumentTableMap::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;
BrandDocumentTableMap::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(BrandDocumentTableMap::ID);
$criteria->addSelectColumn(BrandDocumentTableMap::BRAND_ID);
$criteria->addSelectColumn(BrandDocumentTableMap::FILE);
$criteria->addSelectColumn(BrandDocumentTableMap::POSITION);
$criteria->addSelectColumn(BrandDocumentTableMap::CREATED_AT);
$criteria->addSelectColumn(BrandDocumentTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.BRAND_ID');
$criteria->addSelectColumn($alias . '.FILE');
$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(BrandDocumentTableMap::DATABASE_NAME)->getTable(BrandDocumentTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandDocumentTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(BrandDocumentTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new BrandDocumentTableMap());
}
}
/**
* Performs a DELETE on the database, given a BrandDocument or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or BrandDocument 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(BrandDocumentTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\BrandDocument) { // 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(BrandDocumentTableMap::DATABASE_NAME);
$criteria->add(BrandDocumentTableMap::ID, (array) $values, Criteria::IN);
}
$query = BrandDocumentQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { BrandDocumentTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { BrandDocumentTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the brand_document 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 BrandDocumentQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a BrandDocument or Criteria object.
*
* @param mixed $criteria Criteria or BrandDocument 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(BrandDocumentTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from BrandDocument object
}
if ($criteria->containsKey(BrandDocumentTableMap::ID) && $criteria->keyContainsValue(BrandDocumentTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.BrandDocumentTableMap::ID.')');
}
// Set the correct dbName
$query = BrandDocumentQuery::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;
}
} // BrandDocumentTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BrandDocumentTableMap::buildTableMap();

View File

@@ -0,0 +1,522 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\BrandI18n;
use Thelia\Model\BrandI18nQuery;
/**
* This class defines the structure of the 'brand_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 BrandI18nTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.BrandI18nTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'brand_i18n';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\BrandI18n';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.BrandI18n';
/**
* 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 = 'brand_i18n.ID';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'brand_i18n.LOCALE';
/**
* the column name for the TITLE field
*/
const TITLE = 'brand_i18n.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'brand_i18n.DESCRIPTION';
/**
* the column name for the CHAPO field
*/
const CHAPO = 'brand_i18n.CHAPO';
/**
* the column name for the POSTSCRIPTUM field
*/
const POSTSCRIPTUM = 'brand_i18n.POSTSCRIPTUM';
/**
* the column name for the META_TITLE field
*/
const META_TITLE = 'brand_i18n.META_TITLE';
/**
* the column name for the META_DESCRIPTION field
*/
const META_DESCRIPTION = 'brand_i18n.META_DESCRIPTION';
/**
* the column name for the META_KEYWORDS field
*/
const META_KEYWORDS = 'brand_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(BrandI18nTableMap::ID, BrandI18nTableMap::LOCALE, BrandI18nTableMap::TITLE, BrandI18nTableMap::DESCRIPTION, BrandI18nTableMap::CHAPO, BrandI18nTableMap::POSTSCRIPTUM, BrandI18nTableMap::META_TITLE, BrandI18nTableMap::META_DESCRIPTION, BrandI18nTableMap::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(BrandI18nTableMap::ID => 0, BrandI18nTableMap::LOCALE => 1, BrandI18nTableMap::TITLE => 2, BrandI18nTableMap::DESCRIPTION => 3, BrandI18nTableMap::CHAPO => 4, BrandI18nTableMap::POSTSCRIPTUM => 5, BrandI18nTableMap::META_TITLE => 6, BrandI18nTableMap::META_DESCRIPTION => 7, BrandI18nTableMap::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('brand_i18n');
$this->setPhpName('BrandI18n');
$this->setClassName('\\Thelia\\Model\\BrandI18n');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'brand', '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);
$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('Brand', '\\Thelia\\Model\\Brand', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
} // buildRelations()
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by find*()
* and findPk*() calls.
*
* @param \Thelia\Model\BrandI18n $obj A \Thelia\Model\BrandI18n object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if (null === $key) {
$key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
} // if key === null
self::$instances[$key] = $obj;
}
}
/**
* Removes an object from the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doDelete
* methods in your stub classes -- you may need to explicitly remove objects
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A \Thelia\Model\BrandI18n object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Thelia\Model\BrandI18n) {
$key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
} elseif (is_array($value) && count($value) === 2) {
// assume we've been passed a primary key";
$key = serialize(array((string) $value[0], (string) $value[1]));
} elseif ($value instanceof Criteria) {
self::$instances = [];
return;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\BrandI18n 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 ? BrandI18nTableMap::CLASS_DEFAULT : BrandI18nTableMap::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 (BrandI18n object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = BrandI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = BrandI18nTableMap::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 + BrandI18nTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = BrandI18nTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
BrandI18nTableMap::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 = BrandI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = BrandI18nTableMap::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;
BrandI18nTableMap::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(BrandI18nTableMap::ID);
$criteria->addSelectColumn(BrandI18nTableMap::LOCALE);
$criteria->addSelectColumn(BrandI18nTableMap::TITLE);
$criteria->addSelectColumn(BrandI18nTableMap::DESCRIPTION);
$criteria->addSelectColumn(BrandI18nTableMap::CHAPO);
$criteria->addSelectColumn(BrandI18nTableMap::POSTSCRIPTUM);
$criteria->addSelectColumn(BrandI18nTableMap::META_TITLE);
$criteria->addSelectColumn(BrandI18nTableMap::META_DESCRIPTION);
$criteria->addSelectColumn(BrandI18nTableMap::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(BrandI18nTableMap::DATABASE_NAME)->getTable(BrandI18nTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandI18nTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(BrandI18nTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new BrandI18nTableMap());
}
}
/**
* Performs a DELETE on the database, given a BrandI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or BrandI18n 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(BrandI18nTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\BrandI18n) { // 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(BrandI18nTableMap::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(BrandI18nTableMap::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(BrandI18nTableMap::LOCALE, $value[1]));
$criteria->addOr($criterion);
}
}
$query = BrandI18nQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { BrandI18nTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { BrandI18nTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the brand_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 BrandI18nQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a BrandI18n or Criteria object.
*
* @param mixed $criteria Criteria or BrandI18n 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(BrandI18nTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from BrandI18n object
}
// Set the correct dbName
$query = BrandI18nQuery::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;
}
} // BrandI18nTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BrandI18nTableMap::buildTableMap();

View File

@@ -0,0 +1,498 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\BrandImageI18n;
use Thelia\Model\BrandImageI18nQuery;
/**
* This class defines the structure of the 'brand_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 BrandImageI18nTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.BrandImageI18nTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'brand_image_i18n';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\BrandImageI18n';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.BrandImageI18n';
/**
* 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 = 'brand_image_i18n.ID';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'brand_image_i18n.LOCALE';
/**
* the column name for the TITLE field
*/
const TITLE = 'brand_image_i18n.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'brand_image_i18n.DESCRIPTION';
/**
* the column name for the CHAPO field
*/
const CHAPO = 'brand_image_i18n.CHAPO';
/**
* the column name for the POSTSCRIPTUM field
*/
const POSTSCRIPTUM = 'brand_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(BrandImageI18nTableMap::ID, BrandImageI18nTableMap::LOCALE, BrandImageI18nTableMap::TITLE, BrandImageI18nTableMap::DESCRIPTION, BrandImageI18nTableMap::CHAPO, BrandImageI18nTableMap::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(BrandImageI18nTableMap::ID => 0, BrandImageI18nTableMap::LOCALE => 1, BrandImageI18nTableMap::TITLE => 2, BrandImageI18nTableMap::DESCRIPTION => 3, BrandImageI18nTableMap::CHAPO => 4, BrandImageI18nTableMap::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('brand_image_i18n');
$this->setPhpName('BrandImageI18n');
$this->setClassName('\\Thelia\\Model\\BrandImageI18n');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'brand_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('BrandImage', '\\Thelia\\Model\\BrandImage', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
} // buildRelations()
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by find*()
* and findPk*() calls.
*
* @param \Thelia\Model\BrandImageI18n $obj A \Thelia\Model\BrandImageI18n object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if (null === $key) {
$key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
} // if key === null
self::$instances[$key] = $obj;
}
}
/**
* Removes an object from the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doDelete
* methods in your stub classes -- you may need to explicitly remove objects
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A \Thelia\Model\BrandImageI18n object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Thelia\Model\BrandImageI18n) {
$key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
} elseif (is_array($value) && count($value) === 2) {
// assume we've been passed a primary key";
$key = serialize(array((string) $value[0], (string) $value[1]));
} elseif ($value instanceof Criteria) {
self::$instances = [];
return;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\BrandImageI18n 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 ? BrandImageI18nTableMap::CLASS_DEFAULT : BrandImageI18nTableMap::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 (BrandImageI18n object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = BrandImageI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = BrandImageI18nTableMap::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 + BrandImageI18nTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = BrandImageI18nTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
BrandImageI18nTableMap::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 = BrandImageI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = BrandImageI18nTableMap::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;
BrandImageI18nTableMap::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(BrandImageI18nTableMap::ID);
$criteria->addSelectColumn(BrandImageI18nTableMap::LOCALE);
$criteria->addSelectColumn(BrandImageI18nTableMap::TITLE);
$criteria->addSelectColumn(BrandImageI18nTableMap::DESCRIPTION);
$criteria->addSelectColumn(BrandImageI18nTableMap::CHAPO);
$criteria->addSelectColumn(BrandImageI18nTableMap::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(BrandImageI18nTableMap::DATABASE_NAME)->getTable(BrandImageI18nTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandImageI18nTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(BrandImageI18nTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new BrandImageI18nTableMap());
}
}
/**
* Performs a DELETE on the database, given a BrandImageI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or BrandImageI18n 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(BrandImageI18nTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\BrandImageI18n) { // 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(BrandImageI18nTableMap::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(BrandImageI18nTableMap::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(BrandImageI18nTableMap::LOCALE, $value[1]));
$criteria->addOr($criterion);
}
}
$query = BrandImageI18nQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { BrandImageI18nTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { BrandImageI18nTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the brand_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 BrandImageI18nQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a BrandImageI18n or Criteria object.
*
* @param mixed $criteria Criteria or BrandImageI18n 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(BrandImageI18nTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from BrandImageI18n object
}
// Set the correct dbName
$query = BrandImageI18nQuery::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;
}
} // BrandImageI18nTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BrandImageI18nTableMap::buildTableMap();

View File

@@ -0,0 +1,478 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\BrandImage;
use Thelia\Model\BrandImageQuery;
/**
* This class defines the structure of the 'brand_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 BrandImageTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.BrandImageTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'brand_image';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\BrandImage';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.BrandImage';
/**
* 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 = 'brand_image.ID';
/**
* the column name for the BRAND_ID field
*/
const BRAND_ID = 'brand_image.BRAND_ID';
/**
* the column name for the FILE field
*/
const FILE = 'brand_image.FILE';
/**
* the column name for the POSITION field
*/
const POSITION = 'brand_image.POSITION';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'brand_image.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'brand_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', 'BrandId', 'File', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'brandId', 'file', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(BrandImageTableMap::ID, BrandImageTableMap::BRAND_ID, BrandImageTableMap::FILE, BrandImageTableMap::POSITION, BrandImageTableMap::CREATED_AT, BrandImageTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'BRAND_ID', 'FILE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'brand_id', 'file', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'BrandId' => 1, 'File' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'brandId' => 1, 'file' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
self::TYPE_COLNAME => array(BrandImageTableMap::ID => 0, BrandImageTableMap::BRAND_ID => 1, BrandImageTableMap::FILE => 2, BrandImageTableMap::POSITION => 3, BrandImageTableMap::CREATED_AT => 4, BrandImageTableMap::UPDATED_AT => 5, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'BRAND_ID' => 1, 'FILE' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
self::TYPE_FIELDNAME => array('id' => 0, 'brand_id' => 1, 'file' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('brand_image');
$this->setPhpName('BrandImage');
$this->setClassName('\\Thelia\\Model\\BrandImage');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('BRAND_ID', 'BrandId', 'INTEGER', 'brand', 'ID', true, null, null);
$this->addColumn('FILE', 'File', 'VARCHAR', true, 255, 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('BrandRelatedByBrandId', '\\Thelia\\Model\\Brand', RelationMap::MANY_TO_ONE, array('brand_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('BrandRelatedByLogoImageId', '\\Thelia\\Model\\Brand', RelationMap::ONE_TO_MANY, array('id' => 'logo_image_id', ), 'SET NULL', 'RESTRICT', 'BrandsRelatedByLogoImageId');
$this->addRelation('BrandImageI18n', '\\Thelia\\Model\\BrandImageI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'BrandImageI18ns');
} // 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 brand_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.
BrandTableMap::clearInstancePool();
BrandImageI18nTableMap::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 ? BrandImageTableMap::CLASS_DEFAULT : BrandImageTableMap::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 (BrandImage object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = BrandImageTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = BrandImageTableMap::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 + BrandImageTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = BrandImageTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
BrandImageTableMap::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 = BrandImageTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = BrandImageTableMap::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;
BrandImageTableMap::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(BrandImageTableMap::ID);
$criteria->addSelectColumn(BrandImageTableMap::BRAND_ID);
$criteria->addSelectColumn(BrandImageTableMap::FILE);
$criteria->addSelectColumn(BrandImageTableMap::POSITION);
$criteria->addSelectColumn(BrandImageTableMap::CREATED_AT);
$criteria->addSelectColumn(BrandImageTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.BRAND_ID');
$criteria->addSelectColumn($alias . '.FILE');
$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(BrandImageTableMap::DATABASE_NAME)->getTable(BrandImageTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandImageTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(BrandImageTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new BrandImageTableMap());
}
}
/**
* Performs a DELETE on the database, given a BrandImage or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or BrandImage 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(BrandImageTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\BrandImage) { // 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(BrandImageTableMap::DATABASE_NAME);
$criteria->add(BrandImageTableMap::ID, (array) $values, Criteria::IN);
}
$query = BrandImageQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { BrandImageTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { BrandImageTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the brand_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 BrandImageQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a BrandImage or Criteria object.
*
* @param mixed $criteria Criteria or BrandImage 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(BrandImageTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from BrandImage object
}
if ($criteria->containsKey(BrandImageTableMap::ID) && $criteria->keyContainsValue(BrandImageTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.BrandImageTableMap::ID.')');
}
// Set the correct dbName
$query = BrandImageQuery::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;
}
} // BrandImageTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BrandImageTableMap::buildTableMap();

View File

@@ -0,0 +1,482 @@
<?php
namespace Thelia\Model\Map;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\Brand;
use Thelia\Model\BrandQuery;
/**
* This class defines the structure of the 'brand' 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 BrandTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.BrandTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'brand';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\Brand';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.Brand';
/**
* 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 = 'brand.ID';
/**
* the column name for the VISIBLE field
*/
const VISIBLE = 'brand.VISIBLE';
/**
* the column name for the POSITION field
*/
const POSITION = 'brand.POSITION';
/**
* the column name for the LOGO_IMAGE_ID field
*/
const LOGO_IMAGE_ID = 'brand.LOGO_IMAGE_ID';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'brand.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'brand.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', 'LogoImageId', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'visible', 'position', 'logoImageId', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(BrandTableMap::ID, BrandTableMap::VISIBLE, BrandTableMap::POSITION, BrandTableMap::LOGO_IMAGE_ID, BrandTableMap::CREATED_AT, BrandTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'VISIBLE', 'POSITION', 'LOGO_IMAGE_ID', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'visible', 'position', 'logo_image_id', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Visible' => 1, 'Position' => 2, 'LogoImageId' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'logoImageId' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
self::TYPE_COLNAME => array(BrandTableMap::ID => 0, BrandTableMap::VISIBLE => 1, BrandTableMap::POSITION => 2, BrandTableMap::LOGO_IMAGE_ID => 3, BrandTableMap::CREATED_AT => 4, BrandTableMap::UPDATED_AT => 5, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'LOGO_IMAGE_ID' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
self::TYPE_FIELDNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'logo_image_id' => 3, 'created_at' => 4, 'updated_at' => 5, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('brand');
$this->setPhpName('Brand');
$this->setClassName('\\Thelia\\Model\\Brand');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', false, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
$this->addForeignKey('LOGO_IMAGE_ID', 'LogoImageId', 'INTEGER', 'brand_image', 'ID', 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('BrandImageRelatedByLogoImageId', '\\Thelia\\Model\\BrandImage', RelationMap::MANY_TO_ONE, array('logo_image_id' => 'id', ), 'SET NULL', 'RESTRICT');
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::ONE_TO_MANY, array('id' => 'brand_id', ), 'SET NULL', null, 'Products');
$this->addRelation('BrandDocument', '\\Thelia\\Model\\BrandDocument', RelationMap::ONE_TO_MANY, array('id' => 'brand_id', ), 'CASCADE', 'RESTRICT', 'BrandDocuments');
$this->addRelation('BrandImageRelatedByBrandId', '\\Thelia\\Model\\BrandImage', RelationMap::ONE_TO_MANY, array('id' => 'brand_id', ), 'CASCADE', 'RESTRICT', 'BrandImagesRelatedByBrandId');
$this->addRelation('BrandI18n', '\\Thelia\\Model\\BrandI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'BrandI18ns');
} // 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 brand * 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.
ProductTableMap::clearInstancePool();
BrandDocumentTableMap::clearInstancePool();
BrandImageTableMap::clearInstancePool();
BrandI18nTableMap::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 ? BrandTableMap::CLASS_DEFAULT : BrandTableMap::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 (Brand object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = BrandTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = BrandTableMap::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 + BrandTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = BrandTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
BrandTableMap::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 = BrandTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = BrandTableMap::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;
BrandTableMap::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(BrandTableMap::ID);
$criteria->addSelectColumn(BrandTableMap::VISIBLE);
$criteria->addSelectColumn(BrandTableMap::POSITION);
$criteria->addSelectColumn(BrandTableMap::LOGO_IMAGE_ID);
$criteria->addSelectColumn(BrandTableMap::CREATED_AT);
$criteria->addSelectColumn(BrandTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.LOGO_IMAGE_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(BrandTableMap::DATABASE_NAME)->getTable(BrandTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(BrandTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new BrandTableMap());
}
}
/**
* Performs a DELETE on the database, given a Brand or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Brand 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(BrandTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\Brand) { // 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(BrandTableMap::DATABASE_NAME);
$criteria->add(BrandTableMap::ID, (array) $values, Criteria::IN);
}
$query = BrandQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { BrandTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { BrandTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the brand 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 BrandQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a Brand or Criteria object.
*
* @param mixed $criteria Criteria or Brand 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(BrandTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from Brand object
}
if ($criteria->containsKey(BrandTableMap::ID) && $criteria->keyContainsValue(BrandTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.BrandTableMap::ID.')');
}
// Set the correct dbName
$query = BrandQuery::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;
}
} // BrandTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BrandTableMap::buildTableMap();

View File

@@ -147,8 +147,8 @@ class CouponCustomerCountTableMap extends TableMap
*/ */
public function buildRelations() public function buildRelations()
{ {
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', null); $this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', null); $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations() } // buildRelations()
/** /**

View File

@@ -58,7 +58,7 @@ class CouponTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 16; const NUM_COLUMNS = 18;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -68,7 +68,7 @@ class CouponTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 16; const NUM_HYDRATE_COLUMNS = 18;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -150,6 +150,16 @@ class CouponTableMap extends TableMap
*/ */
const VERSION = 'coupon.VERSION'; const VERSION = 'coupon.VERSION';
/**
* the column name for the VERSION_CREATED_AT field
*/
const VERSION_CREATED_AT = 'coupon.VERSION_CREATED_AT';
/**
* the column name for the VERSION_CREATED_BY field
*/
const VERSION_CREATED_BY = 'coupon.VERSION_CREATED_BY';
/** /**
* The default string format for model objects of the related table * The default string format for model objects of the related table
*/ */
@@ -171,12 +181,12 @@ class CouponTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', 'Version', ), self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', 'version', ), self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::SERIALIZED_EFFECTS, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::IS_USED, CouponTableMap::SERIALIZED_CONDITIONS, CouponTableMap::PER_CUSTOMER_USAGE_COUNT, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ), self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::SERIALIZED_EFFECTS, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::IS_USED, CouponTableMap::SERIALIZED_CONDITIONS, CouponTableMap::PER_CUSTOMER_USAGE_COUNT, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, CouponTableMap::VERSION_CREATED_AT, CouponTableMap::VERSION_CREATED_BY, ),
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', 'version', ), self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
); );
/** /**
@@ -186,12 +196,12 @@ class CouponTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'PerCustomerUsageCount' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, 'Version' => 15, ), self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'PerCustomerUsageCount' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, 'Version' => 15, 'VersionCreatedAt' => 16, 'VersionCreatedBy' => 17, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'perCustomerUsageCount' => 12, 'createdAt' => 13, 'updatedAt' => 14, 'version' => 15, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'perCustomerUsageCount' => 12, 'createdAt' => 13, 'updatedAt' => 14, 'version' => 15, 'versionCreatedAt' => 16, 'versionCreatedBy' => 17, ),
self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::SERIALIZED_EFFECTS => 3, CouponTableMap::IS_ENABLED => 4, CouponTableMap::EXPIRATION_DATE => 5, CouponTableMap::MAX_USAGE => 6, CouponTableMap::IS_CUMULATIVE => 7, CouponTableMap::IS_REMOVING_POSTAGE => 8, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponTableMap::IS_USED => 10, CouponTableMap::SERIALIZED_CONDITIONS => 11, CouponTableMap::PER_CUSTOMER_USAGE_COUNT => 12, CouponTableMap::CREATED_AT => 13, CouponTableMap::UPDATED_AT => 14, CouponTableMap::VERSION => 15, ), self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::SERIALIZED_EFFECTS => 3, CouponTableMap::IS_ENABLED => 4, CouponTableMap::EXPIRATION_DATE => 5, CouponTableMap::MAX_USAGE => 6, CouponTableMap::IS_CUMULATIVE => 7, CouponTableMap::IS_REMOVING_POSTAGE => 8, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponTableMap::IS_USED => 10, CouponTableMap::SERIALIZED_CONDITIONS => 11, CouponTableMap::PER_CUSTOMER_USAGE_COUNT => 12, CouponTableMap::CREATED_AT => 13, CouponTableMap::UPDATED_AT => 14, CouponTableMap::VERSION => 15, CouponTableMap::VERSION_CREATED_AT => 16, CouponTableMap::VERSION_CREATED_BY => 17, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'PER_CUSTOMER_USAGE_COUNT' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, 'VERSION' => 15, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'PER_CUSTOMER_USAGE_COUNT' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, 'VERSION' => 15, 'VERSION_CREATED_AT' => 16, 'VERSION_CREATED_BY' => 17, ),
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'per_customer_usage_count' => 12, 'created_at' => 13, 'updated_at' => 14, 'version' => 15, ), self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'per_customer_usage_count' => 12, 'created_at' => 13, 'updated_at' => 14, 'version' => 15, 'version_created_at' => 16, 'version_created_by' => 17, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
); );
/** /**
@@ -226,6 +236,8 @@ class CouponTableMap extends TableMap
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0); $this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
} // initialize() } // initialize()
/** /**
@@ -235,12 +247,12 @@ class CouponTableMap extends TableMap
{ {
$this->addRelation('CouponCountry', '\\Thelia\\Model\\CouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponCountries'); $this->addRelation('CouponCountry', '\\Thelia\\Model\\CouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponCountries');
$this->addRelation('CouponModule', '\\Thelia\\Model\\CouponModule', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponModules'); $this->addRelation('CouponModule', '\\Thelia\\Model\\CouponModule', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponModules');
$this->addRelation('CouponCustomerCount', '\\Thelia\\Model\\CouponCustomerCount', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponCustomerCounts'); $this->addRelation('CouponCustomerCount', '\\Thelia\\Model\\CouponCustomerCount', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', 'RESTRICT', 'CouponCustomerCounts');
$this->addRelation('CouponI18n', '\\Thelia\\Model\\CouponI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponI18ns'); $this->addRelation('CouponI18n', '\\Thelia\\Model\\CouponI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponI18ns');
$this->addRelation('CouponVersion', '\\Thelia\\Model\\CouponVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponVersions'); $this->addRelation('CouponVersion', '\\Thelia\\Model\\CouponVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponVersions');
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Countries'); $this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Countries');
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Modules'); $this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Modules');
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Customers'); $this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Customers');
} // buildRelations() } // buildRelations()
/** /**
@@ -254,7 +266,7 @@ class CouponTableMap extends TableMap
return array( return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, short_description, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, short_description, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'false', 'log_created_by' => 'false', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ), 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
); );
} // getBehaviors() } // getBehaviors()
/** /**
@@ -425,6 +437,8 @@ class CouponTableMap extends TableMap
$criteria->addSelectColumn(CouponTableMap::CREATED_AT); $criteria->addSelectColumn(CouponTableMap::CREATED_AT);
$criteria->addSelectColumn(CouponTableMap::UPDATED_AT); $criteria->addSelectColumn(CouponTableMap::UPDATED_AT);
$criteria->addSelectColumn(CouponTableMap::VERSION); $criteria->addSelectColumn(CouponTableMap::VERSION);
$criteria->addSelectColumn(CouponTableMap::VERSION_CREATED_AT);
$criteria->addSelectColumn(CouponTableMap::VERSION_CREATED_BY);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.CODE');
@@ -442,6 +456,8 @@ class CouponTableMap extends TableMap
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION'); $criteria->addSelectColumn($alias . '.VERSION');
$criteria->addSelectColumn($alias . '.VERSION_CREATED_AT');
$criteria->addSelectColumn($alias . '.VERSION_CREATED_BY');
} }
} }

View File

@@ -58,7 +58,7 @@ class CouponVersionTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 16; const NUM_COLUMNS = 18;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -68,7 +68,7 @@ class CouponVersionTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 16; const NUM_HYDRATE_COLUMNS = 18;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -150,6 +150,16 @@ class CouponVersionTableMap extends TableMap
*/ */
const VERSION = 'coupon_version.VERSION'; const VERSION = 'coupon_version.VERSION';
/**
* the column name for the VERSION_CREATED_AT field
*/
const VERSION_CREATED_AT = 'coupon_version.VERSION_CREATED_AT';
/**
* the column name for the VERSION_CREATED_BY field
*/
const VERSION_CREATED_BY = 'coupon_version.VERSION_CREATED_BY';
/** /**
* The default string format for model objects of the related table * The default string format for model objects of the related table
*/ */
@@ -162,12 +172,12 @@ class CouponVersionTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', 'Version', ), self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', 'version', ), self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::SERIALIZED_EFFECTS, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::IS_USED, CouponVersionTableMap::SERIALIZED_CONDITIONS, CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ), self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::SERIALIZED_EFFECTS, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::IS_USED, CouponVersionTableMap::SERIALIZED_CONDITIONS, CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, CouponVersionTableMap::VERSION_CREATED_AT, CouponVersionTableMap::VERSION_CREATED_BY, ),
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', 'version', ), self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
); );
/** /**
@@ -177,12 +187,12 @@ class CouponVersionTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'PerCustomerUsageCount' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, 'Version' => 15, ), self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'PerCustomerUsageCount' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, 'Version' => 15, 'VersionCreatedAt' => 16, 'VersionCreatedBy' => 17, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'perCustomerUsageCount' => 12, 'createdAt' => 13, 'updatedAt' => 14, 'version' => 15, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'perCustomerUsageCount' => 12, 'createdAt' => 13, 'updatedAt' => 14, 'version' => 15, 'versionCreatedAt' => 16, 'versionCreatedBy' => 17, ),
self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::SERIALIZED_EFFECTS => 3, CouponVersionTableMap::IS_ENABLED => 4, CouponVersionTableMap::EXPIRATION_DATE => 5, CouponVersionTableMap::MAX_USAGE => 6, CouponVersionTableMap::IS_CUMULATIVE => 7, CouponVersionTableMap::IS_REMOVING_POSTAGE => 8, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponVersionTableMap::IS_USED => 10, CouponVersionTableMap::SERIALIZED_CONDITIONS => 11, CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT => 12, CouponVersionTableMap::CREATED_AT => 13, CouponVersionTableMap::UPDATED_AT => 14, CouponVersionTableMap::VERSION => 15, ), self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::SERIALIZED_EFFECTS => 3, CouponVersionTableMap::IS_ENABLED => 4, CouponVersionTableMap::EXPIRATION_DATE => 5, CouponVersionTableMap::MAX_USAGE => 6, CouponVersionTableMap::IS_CUMULATIVE => 7, CouponVersionTableMap::IS_REMOVING_POSTAGE => 8, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponVersionTableMap::IS_USED => 10, CouponVersionTableMap::SERIALIZED_CONDITIONS => 11, CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT => 12, CouponVersionTableMap::CREATED_AT => 13, CouponVersionTableMap::UPDATED_AT => 14, CouponVersionTableMap::VERSION => 15, CouponVersionTableMap::VERSION_CREATED_AT => 16, CouponVersionTableMap::VERSION_CREATED_BY => 17, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'PER_CUSTOMER_USAGE_COUNT' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, 'VERSION' => 15, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'PER_CUSTOMER_USAGE_COUNT' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, 'VERSION' => 15, 'VERSION_CREATED_AT' => 16, 'VERSION_CREATED_BY' => 17, ),
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'per_customer_usage_count' => 12, 'created_at' => 13, 'updated_at' => 14, 'version' => 15, ), self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'per_customer_usage_count' => 12, 'created_at' => 13, 'updated_at' => 14, 'version' => 15, 'version_created_at' => 16, 'version_created_by' => 17, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
); );
/** /**
@@ -217,6 +227,8 @@ class CouponVersionTableMap extends TableMap
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0); $this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
} // initialize() } // initialize()
/** /**
@@ -430,6 +442,8 @@ class CouponVersionTableMap extends TableMap
$criteria->addSelectColumn(CouponVersionTableMap::CREATED_AT); $criteria->addSelectColumn(CouponVersionTableMap::CREATED_AT);
$criteria->addSelectColumn(CouponVersionTableMap::UPDATED_AT); $criteria->addSelectColumn(CouponVersionTableMap::UPDATED_AT);
$criteria->addSelectColumn(CouponVersionTableMap::VERSION); $criteria->addSelectColumn(CouponVersionTableMap::VERSION);
$criteria->addSelectColumn(CouponVersionTableMap::VERSION_CREATED_AT);
$criteria->addSelectColumn(CouponVersionTableMap::VERSION_CREATED_BY);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.CODE');
@@ -447,6 +461,8 @@ class CouponVersionTableMap extends TableMap
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION'); $criteria->addSelectColumn($alias . '.VERSION');
$criteria->addSelectColumn($alias . '.VERSION_CREATED_AT');
$criteria->addSelectColumn($alias . '.VERSION_CREATED_BY');
} }
} }

View File

@@ -228,8 +228,8 @@ class CustomerTableMap extends TableMap
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Addresses'); $this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Addresses');
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'RESTRICT', 'RESTRICT', 'Orders'); $this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'RESTRICT', 'RESTRICT', 'Orders');
$this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Carts'); $this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Carts');
$this->addRelation('CouponCustomerCount', '\\Thelia\\Model\\CouponCustomerCount', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', null, 'CouponCustomerCounts'); $this->addRelation('CouponCustomerCount', '\\Thelia\\Model\\CouponCustomerCount', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'CouponCustomerCounts');
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Coupons'); $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Coupons');
} // buildRelations() } // buildRelations()
/** /**

View File

@@ -58,7 +58,7 @@ class ProductTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 11; const NUM_COLUMNS = 12;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -68,7 +68,7 @@ class ProductTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 11; const NUM_HYDRATE_COLUMNS = 12;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -100,6 +100,11 @@ class ProductTableMap extends TableMap
*/ */
const TEMPLATE_ID = 'product.TEMPLATE_ID'; const TEMPLATE_ID = 'product.TEMPLATE_ID';
/**
* the column name for the BRAND_ID field
*/
const BRAND_ID = 'product.BRAND_ID';
/** /**
* the column name for the CREATED_AT field * the column name for the CREATED_AT field
*/ */
@@ -146,12 +151,12 @@ class ProductTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'BrandId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', 'brandId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
self::TYPE_COLNAME => array(ProductTableMap::ID, ProductTableMap::TAX_RULE_ID, ProductTableMap::REF, ProductTableMap::VISIBLE, ProductTableMap::POSITION, ProductTableMap::TEMPLATE_ID, ProductTableMap::CREATED_AT, ProductTableMap::UPDATED_AT, ProductTableMap::VERSION, ProductTableMap::VERSION_CREATED_AT, ProductTableMap::VERSION_CREATED_BY, ), self::TYPE_COLNAME => array(ProductTableMap::ID, ProductTableMap::TAX_RULE_ID, ProductTableMap::REF, ProductTableMap::VISIBLE, ProductTableMap::POSITION, ProductTableMap::TEMPLATE_ID, ProductTableMap::BRAND_ID, ProductTableMap::CREATED_AT, ProductTableMap::UPDATED_AT, ProductTableMap::VERSION, ProductTableMap::VERSION_CREATED_AT, ProductTableMap::VERSION_CREATED_BY, ),
self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'TEMPLATE_ID', 'BRAND_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_id', 'brand_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
); );
/** /**
@@ -161,12 +166,12 @@ class ProductTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'TemplateId' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, 'Version' => 8, 'VersionCreatedAt' => 9, 'VersionCreatedBy' => 10, ), self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'TemplateId' => 5, 'BrandId' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, 'Version' => 9, 'VersionCreatedAt' => 10, 'VersionCreatedBy' => 11, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'templateId' => 5, 'createdAt' => 6, 'updatedAt' => 7, 'version' => 8, 'versionCreatedAt' => 9, 'versionCreatedBy' => 10, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'templateId' => 5, 'brandId' => 6, 'createdAt' => 7, 'updatedAt' => 8, 'version' => 9, 'versionCreatedAt' => 10, 'versionCreatedBy' => 11, ),
self::TYPE_COLNAME => array(ProductTableMap::ID => 0, ProductTableMap::TAX_RULE_ID => 1, ProductTableMap::REF => 2, ProductTableMap::VISIBLE => 3, ProductTableMap::POSITION => 4, ProductTableMap::TEMPLATE_ID => 5, ProductTableMap::CREATED_AT => 6, ProductTableMap::UPDATED_AT => 7, ProductTableMap::VERSION => 8, ProductTableMap::VERSION_CREATED_AT => 9, ProductTableMap::VERSION_CREATED_BY => 10, ), self::TYPE_COLNAME => array(ProductTableMap::ID => 0, ProductTableMap::TAX_RULE_ID => 1, ProductTableMap::REF => 2, ProductTableMap::VISIBLE => 3, ProductTableMap::POSITION => 4, ProductTableMap::TEMPLATE_ID => 5, ProductTableMap::BRAND_ID => 6, ProductTableMap::CREATED_AT => 7, ProductTableMap::UPDATED_AT => 8, ProductTableMap::VERSION => 9, ProductTableMap::VERSION_CREATED_AT => 10, ProductTableMap::VERSION_CREATED_BY => 11, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'TEMPLATE_ID' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, 'VERSION' => 8, 'VERSION_CREATED_AT' => 9, 'VERSION_CREATED_BY' => 10, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'TEMPLATE_ID' => 5, 'BRAND_ID' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, 'VERSION' => 9, 'VERSION_CREATED_AT' => 10, 'VERSION_CREATED_BY' => 11, ),
self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'template_id' => 5, 'created_at' => 6, 'updated_at' => 7, 'version' => 8, 'version_created_at' => 9, 'version_created_by' => 10, ), self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'template_id' => 5, 'brand_id' => 6, 'created_at' => 7, 'updated_at' => 8, 'version' => 9, 'version_created_at' => 10, 'version_created_by' => 11, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
); );
/** /**
@@ -191,6 +196,7 @@ class ProductTableMap extends TableMap
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0); $this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, 0); $this->addColumn('POSITION', 'Position', 'INTEGER', true, null, 0);
$this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', false, null, null); $this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', false, null, null);
$this->addForeignKey('BRAND_ID', 'BrandId', 'INTEGER', 'brand', 'ID', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0); $this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
@@ -205,6 +211,7 @@ class ProductTableMap extends TableMap
{ {
$this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'RESTRICT', 'RESTRICT'); $this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), null, null); $this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), null, null);
$this->addRelation('Brand', '\\Thelia\\Model\\Brand', RelationMap::MANY_TO_ONE, array('brand_id' => 'id', ), 'SET NULL', null);
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories'); $this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
$this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts'); $this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts');
$this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductSaleElementss'); $this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductSaleElementss');
@@ -398,6 +405,7 @@ class ProductTableMap extends TableMap
$criteria->addSelectColumn(ProductTableMap::VISIBLE); $criteria->addSelectColumn(ProductTableMap::VISIBLE);
$criteria->addSelectColumn(ProductTableMap::POSITION); $criteria->addSelectColumn(ProductTableMap::POSITION);
$criteria->addSelectColumn(ProductTableMap::TEMPLATE_ID); $criteria->addSelectColumn(ProductTableMap::TEMPLATE_ID);
$criteria->addSelectColumn(ProductTableMap::BRAND_ID);
$criteria->addSelectColumn(ProductTableMap::CREATED_AT); $criteria->addSelectColumn(ProductTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductTableMap::UPDATED_AT); $criteria->addSelectColumn(ProductTableMap::UPDATED_AT);
$criteria->addSelectColumn(ProductTableMap::VERSION); $criteria->addSelectColumn(ProductTableMap::VERSION);
@@ -410,6 +418,7 @@ class ProductTableMap extends TableMap
$criteria->addSelectColumn($alias . '.VISIBLE'); $criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID'); $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.BRAND_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION'); $criteria->addSelectColumn($alias . '.VERSION');

View File

@@ -58,7 +58,7 @@ class ProductVersionTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 11; const NUM_COLUMNS = 12;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -68,7 +68,7 @@ class ProductVersionTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 11; const NUM_HYDRATE_COLUMNS = 12;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -100,6 +100,11 @@ class ProductVersionTableMap extends TableMap
*/ */
const TEMPLATE_ID = 'product_version.TEMPLATE_ID'; const TEMPLATE_ID = 'product_version.TEMPLATE_ID';
/**
* the column name for the BRAND_ID field
*/
const BRAND_ID = 'product_version.BRAND_ID';
/** /**
* the column name for the CREATED_AT field * the column name for the CREATED_AT field
*/ */
@@ -137,12 +142,12 @@ class ProductVersionTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'BrandId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', 'brandId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
self::TYPE_COLNAME => array(ProductVersionTableMap::ID, ProductVersionTableMap::TAX_RULE_ID, ProductVersionTableMap::REF, ProductVersionTableMap::VISIBLE, ProductVersionTableMap::POSITION, ProductVersionTableMap::TEMPLATE_ID, ProductVersionTableMap::CREATED_AT, ProductVersionTableMap::UPDATED_AT, ProductVersionTableMap::VERSION, ProductVersionTableMap::VERSION_CREATED_AT, ProductVersionTableMap::VERSION_CREATED_BY, ), self::TYPE_COLNAME => array(ProductVersionTableMap::ID, ProductVersionTableMap::TAX_RULE_ID, ProductVersionTableMap::REF, ProductVersionTableMap::VISIBLE, ProductVersionTableMap::POSITION, ProductVersionTableMap::TEMPLATE_ID, ProductVersionTableMap::BRAND_ID, ProductVersionTableMap::CREATED_AT, ProductVersionTableMap::UPDATED_AT, ProductVersionTableMap::VERSION, ProductVersionTableMap::VERSION_CREATED_AT, ProductVersionTableMap::VERSION_CREATED_BY, ),
self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'TEMPLATE_ID', 'BRAND_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_id', 'brand_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
); );
/** /**
@@ -152,12 +157,12 @@ class ProductVersionTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'TemplateId' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, 'Version' => 8, 'VersionCreatedAt' => 9, 'VersionCreatedBy' => 10, ), self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'TemplateId' => 5, 'BrandId' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, 'Version' => 9, 'VersionCreatedAt' => 10, 'VersionCreatedBy' => 11, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'templateId' => 5, 'createdAt' => 6, 'updatedAt' => 7, 'version' => 8, 'versionCreatedAt' => 9, 'versionCreatedBy' => 10, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'templateId' => 5, 'brandId' => 6, 'createdAt' => 7, 'updatedAt' => 8, 'version' => 9, 'versionCreatedAt' => 10, 'versionCreatedBy' => 11, ),
self::TYPE_COLNAME => array(ProductVersionTableMap::ID => 0, ProductVersionTableMap::TAX_RULE_ID => 1, ProductVersionTableMap::REF => 2, ProductVersionTableMap::VISIBLE => 3, ProductVersionTableMap::POSITION => 4, ProductVersionTableMap::TEMPLATE_ID => 5, ProductVersionTableMap::CREATED_AT => 6, ProductVersionTableMap::UPDATED_AT => 7, ProductVersionTableMap::VERSION => 8, ProductVersionTableMap::VERSION_CREATED_AT => 9, ProductVersionTableMap::VERSION_CREATED_BY => 10, ), self::TYPE_COLNAME => array(ProductVersionTableMap::ID => 0, ProductVersionTableMap::TAX_RULE_ID => 1, ProductVersionTableMap::REF => 2, ProductVersionTableMap::VISIBLE => 3, ProductVersionTableMap::POSITION => 4, ProductVersionTableMap::TEMPLATE_ID => 5, ProductVersionTableMap::BRAND_ID => 6, ProductVersionTableMap::CREATED_AT => 7, ProductVersionTableMap::UPDATED_AT => 8, ProductVersionTableMap::VERSION => 9, ProductVersionTableMap::VERSION_CREATED_AT => 10, ProductVersionTableMap::VERSION_CREATED_BY => 11, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'TEMPLATE_ID' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, 'VERSION' => 8, 'VERSION_CREATED_AT' => 9, 'VERSION_CREATED_BY' => 10, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'TEMPLATE_ID' => 5, 'BRAND_ID' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, 'VERSION' => 9, 'VERSION_CREATED_AT' => 10, 'VERSION_CREATED_BY' => 11, ),
self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'template_id' => 5, 'created_at' => 6, 'updated_at' => 7, 'version' => 8, 'version_created_at' => 9, 'version_created_by' => 10, ), self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'template_id' => 5, 'brand_id' => 6, 'created_at' => 7, 'updated_at' => 8, 'version' => 9, 'version_created_at' => 10, 'version_created_by' => 11, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
); );
/** /**
@@ -182,6 +187,7 @@ class ProductVersionTableMap extends TableMap
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0); $this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, 0); $this->addColumn('POSITION', 'Position', 'INTEGER', true, null, 0);
$this->addColumn('TEMPLATE_ID', 'TemplateId', 'INTEGER', false, null, null); $this->addColumn('TEMPLATE_ID', 'TemplateId', 'INTEGER', false, null, null);
$this->addColumn('BRAND_ID', 'BrandId', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0); $this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
@@ -264,11 +270,11 @@ class ProductVersionTableMap extends TableMap
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = 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 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 ? 8 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) { if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 9 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return 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 ? 8 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 9 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
} }
/** /**
@@ -390,6 +396,7 @@ class ProductVersionTableMap extends TableMap
$criteria->addSelectColumn(ProductVersionTableMap::VISIBLE); $criteria->addSelectColumn(ProductVersionTableMap::VISIBLE);
$criteria->addSelectColumn(ProductVersionTableMap::POSITION); $criteria->addSelectColumn(ProductVersionTableMap::POSITION);
$criteria->addSelectColumn(ProductVersionTableMap::TEMPLATE_ID); $criteria->addSelectColumn(ProductVersionTableMap::TEMPLATE_ID);
$criteria->addSelectColumn(ProductVersionTableMap::BRAND_ID);
$criteria->addSelectColumn(ProductVersionTableMap::CREATED_AT); $criteria->addSelectColumn(ProductVersionTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductVersionTableMap::UPDATED_AT); $criteria->addSelectColumn(ProductVersionTableMap::UPDATED_AT);
$criteria->addSelectColumn(ProductVersionTableMap::VERSION); $criteria->addSelectColumn(ProductVersionTableMap::VERSION);
@@ -402,6 +409,7 @@ class ProductVersionTableMap extends TableMap
$criteria->addSelectColumn($alias . '.VISIBLE'); $criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID'); $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.BRAND_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION'); $criteria->addSelectColumn($alias . '.VERSION');

View File

@@ -33,12 +33,13 @@
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="tax_rule_id" type="INTEGER" /> <column name="tax_rule_id" type="INTEGER" />
<column name="ref" required="true" size="255" type="VARCHAR" /> <column name="ref" required="true" size="255" type="VARCHAR" />
<column defaultValue="0" name="visible" required="true" type="TINYINT" /> <column defaultValue="0" name="visible" required="true" type="TINYINT" />
<column defaultValue="0" name="position" required="true" type="INTEGER" /> <column defaultValue="0" name="position" required="true" type="INTEGER" />
<column name="title" size="255" type="VARCHAR" /> <column name="title" size="255" type="VARCHAR" />
<column name="description" type="CLOB" /> <column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" /> <column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" /> <column name="postscriptum" type="LONGVARCHAR" />
<column name="template_id" type="INTEGER" />
<column name="brand_id" type="INTEGER" /> <column name="brand_id" type="INTEGER" />
<column name="meta_title" size="255" type="VARCHAR" /> <column name="meta_title" size="255" type="VARCHAR" />
<column name="meta_description" type="LONGVARCHAR" /> <column name="meta_description" type="LONGVARCHAR" />
@@ -48,6 +49,9 @@
</foreign-key> </foreign-key>
<foreign-key foreignTable="template" name="fk_product_template"> <foreign-key foreignTable="template" name="fk_product_template">
<reference foreign="id" local="template_id" /> <reference foreign="id" local="template_id" />
</foreign-key>
<foreign-key foreignTable="brand" name="fk_product_brand" onDelete="SET NULL">
<reference foreign="id" local="brand_id" />
</foreign-key> </foreign-key>
<unique name="ref_UNIQUE"> <unique name="ref_UNIQUE">
<unique-column name="ref" /> <unique-column name="ref" />
@@ -57,6 +61,9 @@
</index> </index>
<index name="fk_product_template_id"> <index name="fk_product_template_id">
<index-column name="template_id" /> <index-column name="template_id" />
</index>
<index name="fk_product_brand1_idx">
<index-column name="brand_id" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -105,6 +112,9 @@
</foreign-key> </foreign-key>
<index name="idx_country_area_id"> <index name="idx_country_area_id">
<index-column name="area_id" /> <index-column name="area_id" />
</index>
<index name="idx_country_by_default">
<index-column name="by_default" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -154,6 +164,11 @@
</index> </index>
<index name="idx_tax_rule_country_country_id"> <index name="idx_tax_rule_country_country_id">
<index-column name="country_id" /> <index-column name="country_id" />
</index>
<index name="idx_tax_rule_country_tax_rule_id_country_id_position">
<index-column name="tax_rule_id" />
<index-column name="country_id" />
<index-column name="position" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
@@ -213,6 +228,11 @@
</index> </index>
<index name="idx_feature_prod_feature_av_id"> <index name="idx_feature_prod_feature_av_id">
<index-column name="feature_av_id" /> <index-column name="feature_av_id" />
</index>
<index name="idx_feature_product_product_id_feature_id_position">
<index-column name="product_id" />
<index-column name="feature_id" />
<index-column name="position" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
@@ -232,6 +252,10 @@
</index> </index>
<index name="fk_feature_template_idx"> <index name="fk_feature_template_idx">
<index-column name="template_id" /> <index-column name="template_id" />
</index>
<index name="idx_feature_template_template_id_position">
<index-column name="template_id" />
<index-column name="position" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
@@ -308,6 +332,11 @@
</index> </index>
<index name="ref"> <index name="ref">
<index-column name="ref" /> <index-column name="ref" />
</index>
<index name="idx_product_elements_product_id_promo_is_default">
<index-column name="product_id" />
<index-column name="promo" />
<index-column name="is_default" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
@@ -349,7 +378,7 @@
</behavior> </behavior>
</table> </table>
<table name="customer" namespace="Thelia\Model"> <table name="customer" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="ref" size="50" type="VARCHAR" /> <column name="ref" size="50" type="VARCHAR" />
<column name="title_id" required="true" type="INTEGER" /> <column name="title_id" required="true" type="INTEGER" />
<column name="firstname" required="true" size="255" type="VARCHAR" /> <column name="firstname" required="true" size="255" type="VARCHAR" />
@@ -365,12 +394,12 @@
<column name="remember_me_serial" size="255" type="VARCHAR" /> <column name="remember_me_serial" size="255" type="VARCHAR" />
<foreign-key foreignTable="customer_title" name="fk_customer_customer_title_id" onDelete="RESTRICT" onUpdate="RESTRICT"> <foreign-key foreignTable="customer_title" name="fk_customer_customer_title_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="title_id" /> <reference foreign="id" local="title_id" />
</foreign-key>
<unique name="ref_UNIQUE">
<unique-column name="ref" />
</foreign-key> </foreign-key>
<index name="idx_customer_customer_title_id"> <index name="idx_customer_customer_title_id">
<index-column name="title_id" /> <index-column name="title_id" />
</index>
<unique name="ref_UNIQUE">
<unique-column name="ref" />
</unique> </unique>
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
@@ -435,6 +464,9 @@
<column name="thousands_separator" size="45" type="VARCHAR" /> <column name="thousands_separator" size="45" type="VARCHAR" />
<column name="decimals" size="45" type="VARCHAR" /> <column name="decimals" size="45" type="VARCHAR" />
<column name="by_default" type="TINYINT" /> <column name="by_default" type="TINYINT" />
<column name="position" type="INTEGER" />
<index name="idx_lang_by_default">
<index-column name="by_default" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
@@ -493,6 +525,10 @@
</foreign-key> </foreign-key>
<index name="idx_product_image_product_id"> <index name="idx_product_image_product_id">
<index-column name="product_id" /> <index-column name="product_id" />
</index>
<index name="idx_product_image_product_id_position">
<index-column name="product_id" />
<index-column name="position" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -520,7 +556,7 @@
</behavior> </behavior>
</table> </table>
<table name="order" namespace="Thelia\Model"> <table name="order" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="ref" size="45" type="VARCHAR" /> <column name="ref" size="45" type="VARCHAR" />
<column name="customer_id" required="true" type="INTEGER" /> <column name="customer_id" required="true" type="INTEGER" />
<column name="invoice_order_address_id" required="true" type="INTEGER" /> <column name="invoice_order_address_id" required="true" type="INTEGER" />
@@ -601,6 +637,12 @@
<column name="symbol" size="45" type="VARCHAR" /> <column name="symbol" size="45" type="VARCHAR" />
<column name="rate" type="FLOAT" /> <column name="rate" type="FLOAT" />
<column name="position" type="INTEGER" /> <column name="position" type="INTEGER" />
<column name="by_default" type="TINYINT" />
<index name="idx_currency_by_default">
<index-column name="by_default" />
</index>
<index name="idx_currency_code">
<index-column name="code" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -696,6 +738,9 @@
<column name="full_namespace" size="255" type="VARCHAR" /> <column name="full_namespace" size="255" type="VARCHAR" />
<unique name="code_UNIQUE"> <unique name="code_UNIQUE">
<unique-column name="code" /> <unique-column name="code" />
</unique>
<index name="idx_module_activate">
<index-column name="activate" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -877,6 +922,7 @@
<column name="is_removing_postage" required="true" type="BOOLEAN" /> <column name="is_removing_postage" required="true" type="BOOLEAN" />
<column name="is_available_on_special_offers" required="true" type="BOOLEAN" /> <column name="is_available_on_special_offers" required="true" type="BOOLEAN" />
<column name="is_used" required="true" type="BOOLEAN" /> <column name="is_used" required="true" type="BOOLEAN" />
<column name="serialized_conditions" required="true" type="LONGVARCHAR" />
<column name="per_customer_usage_count" required="true" type="BOOLEAN" /> <column name="per_customer_usage_count" required="true" type="BOOLEAN" />
<unique name="code_UNIQUE"> <unique name="code_UNIQUE">
<unique-column name="code" /> <unique-column name="code" />
@@ -1047,6 +1093,10 @@
</foreign-key> </foreign-key>
<index name="idx_category_image_category_id"> <index name="idx_category_image_category_id">
<index-column name="category_id" /> <index-column name="category_id" />
</index>
<index name="idx_category_image_category_id_position">
<index-column name="category_id" />
<index-column name="position" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -1067,6 +1117,10 @@
</foreign-key> </foreign-key>
<index name="idx_folder_image_folder_id"> <index name="idx_folder_image_folder_id">
<index-column name="folder_id" /> <index-column name="folder_id" />
</index>
<index name="idx_folder_image_folder_id_position">
<index-column name="folder_id" />
<index-column name="position" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -1087,6 +1141,10 @@
</foreign-key> </foreign-key>
<index name="idx_content_image_content_id"> <index name="idx_content_image_content_id">
<index-column name="content_id" /> <index-column name="content_id" />
</index>
<index name="idx_content_image_content_id_position">
<index-column name="content_id" />
<index-column name="position" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -1203,9 +1261,6 @@
</foreign-key> </foreign-key>
<unique name="url_UNIQUE"> <unique name="url_UNIQUE">
<unique-column name="url" /> <unique-column name="url" />
</unique>
<index name="idx_view_id">
<index-column name="view_id" />
</unique> </unique>
<index name="idx_rewriting_url_redirected"> <index name="idx_rewriting_url_redirected">
<index-column name="redirected" /> <index-column name="redirected" />
@@ -1246,6 +1301,10 @@
</foreign-key> </foreign-key>
<index name="idx_module_image_module_id"> <index name="idx_module_image_module_id">
<index-column name="module_id" /> <index-column name="module_id" />
</index>
<index name="idx_module_image_module_id_position">
<index-column name="module_id" />
<index-column name="position" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -1291,6 +1350,7 @@
<column name="is_cumulative" required="true" type="BOOLEAN" /> <column name="is_cumulative" required="true" type="BOOLEAN" />
<column name="is_removing_postage" required="true" type="BOOLEAN" /> <column name="is_removing_postage" required="true" type="BOOLEAN" />
<column name="is_available_on_special_offers" required="true" type="BOOLEAN" /> <column name="is_available_on_special_offers" required="true" type="BOOLEAN" />
<column name="serialized_conditions" required="true" type="LONGVARCHAR" />
<column name="per_customer_usage_count" required="true" type="BOOLEAN" /> <column name="per_customer_usage_count" required="true" type="BOOLEAN" />
<foreign-key foreignTable="order" name="fk_order_coupon_order_id" onDelete="CASCADE" onUpdate="RESTRICT"> <foreign-key foreignTable="order" name="fk_order_coupon_order_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="order_id" /> <reference foreign="id" local="order_id" />
@@ -1299,4 +1359,136 @@
<index-column name="order_id" /> <index-column name="order_id" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
</table>
<table isCrossRef="true" name="coupon_country" namespace="Thelia\Model">
<column name="coupon_id" primaryKey="true" required="true" type="INTEGER" />
<column name="country_id" primaryKey="true" required="true" type="INTEGER" />
<foreign-key foreignTable="country" name="fk_coupon_country_country_id" onDelete="CASCADE">
<reference foreign="id" local="country_id" />
</foreign-key>
<foreign-key foreignTable="coupon" name="fk_coupon_country_coupon_id" onDelete="CASCADE">
<reference foreign="id" local="coupon_id" />
</foreign-key>
<index name="fk_country_id_idx">
<index-column name="country_id" />
</index>
</table>
<table isCrossRef="true" name="coupon_module" namespace="Thelia\Model">
<column name="coupon_id" primaryKey="true" required="true" type="INTEGER" />
<column name="module_id" primaryKey="true" required="true" type="INTEGER" />
<foreign-key foreignTable="coupon" name="fk_coupon_module_coupon_id" onDelete="CASCADE">
<reference foreign="id" local="coupon_id" />
</foreign-key>
<foreign-key foreignTable="module" name="fk_coupon_module_module_id" onDelete="CASCADE">
<reference foreign="id" local="module_id" />
</foreign-key>
<index name="fk_module_id_idx">
<index-column name="module_id" />
</index>
</table>
<table isCrossRef="true" name="order_coupon_country" namespace="Thelia\Model">
<column name="coupon_id" primaryKey="true" required="true" type="INTEGER" />
<column name="country_id" primaryKey="true" required="true" type="INTEGER" />
<foreign-key foreignTable="country" name="fk_order_coupon_country_country_id" onDelete="CASCADE">
<reference foreign="id" local="country_id" />
</foreign-key>
<foreign-key foreignTable="order_coupon" name="fk_order_coupon_country_coupon_id">
<reference foreign="id" local="coupon_id" />
</foreign-key>
<index name="fk_country_id_idx">
<index-column name="country_id" />
</index>
</table>
<table isCrossRef="true" name="order_coupon_module" namespace="Thelia\Model">
<column name="coupon_id" primaryKey="true" required="true" type="INTEGER" />
<column name="module_id" primaryKey="true" required="true" type="INTEGER" />
<foreign-key foreignTable="order_coupon" name="fk_coupon_module_coupon_id0" onDelete="CASCADE">
<reference foreign="id" local="coupon_id" />
</foreign-key>
<foreign-key foreignTable="module" name="fk_coupon_module_module_id0" onDelete="CASCADE">
<reference foreign="id" local="module_id" />
</foreign-key>
<index name="fk_module_id_idx">
<index-column name="module_id" />
</index>
</table>
<table isCrossRef="true" name="coupon_customer_count" namespace="Thelia\Model">
<column name="coupon_id" required="true" type="INTEGER" />
<column name="customer_id" required="true" type="INTEGER" />
<column defaultValue="0" name="count" required="true" type="INTEGER" />
<foreign-key foreignTable="customer" name="fk_coupon_customer_customer_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="customer_id" />
</foreign-key>
<foreign-key foreignTable="coupon" name="fk_coupon_customer_coupon_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="coupon_id" />
</foreign-key>
<index name="fk_coupon_customer_customer_id_idx">
<index-column name="customer_id" />
</index>
<index name="fk_coupon_customer_coupon_id_idx">
<index-column name="coupon_id" />
</index>
</table>
<table name="brand" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column defaultValue="NULL" name="visible" type="TINYINT" />
<column defaultValue="NULL" name="title" size="255" type="VARCHAR" />
<column defaultValue="NULL" name="description" type="CLOB" />
<column defaultValue="NULL" name="chapo" type="LONGVARCHAR" />
<column defaultValue="NULL" name="postscriptum" type="LONGVARCHAR" />
<column name="position" type="INTEGER" />
<column defaultValue="NULL" name="logo_image_id" type="INTEGER" />
<column defaultValue="NULL" name="meta_title" size="255" type="VARCHAR" />
<column defaultValue="NULL" name="meta_description" type="LONGVARCHAR" />
<column defaultValue="NULL" name="meta_keywords" type="LONGVARCHAR" />
<foreign-key foreignTable="brand_image" name="fk_logo_image_id_brand_image" onDelete="SET NULL" onUpdate="RESTRICT">
<reference foreign="id" local="logo_image_id" />
</foreign-key>
<index name="fk_brand_brand_image_idx">
<index-column name="logo_image_id" />
</index>
<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="brand_document" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="brand_id" required="true" type="INTEGER" />
<column name="file" required="true" size="255" type="VARCHAR" />
<column defaultValue="NULL" name="position" type="INTEGER" />
<column defaultValue="NULL" name="title" size="255" type="VARCHAR" />
<column defaultValue="NULL" name="description" type="CLOB" />
<column defaultValue="NULL" name="chapo" type="LONGVARCHAR" />
<column defaultValue="NULL" name="postscriptum" type="LONGVARCHAR" />
<foreign-key foreignTable="brand" name="fk_brand_document_brand_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="brand_id" />
</foreign-key>
<index name="idx_brand_document_brand_id">
<index-column name="brand_id" />
</index>
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
</behavior>
</table>
<table name="brand_image" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="brand_id" required="true" type="INTEGER" />
<column name="file" required="true" size="255" type="VARCHAR" />
<column name="position" type="INTEGER" />
<column defaultValue="NULL" name="title" size="255" type="VARCHAR" />
<column defaultValue="NULL" name="description" type="CLOB" />
<column defaultValue="NULL" name="chapo" type="LONGVARCHAR" />
<column defaultValue="NULL" name="postscriptum" type="LONGVARCHAR" />
<foreign-key foreignTable="brand" name="fk_brand_image_brand_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="brand_id" />
</foreign-key>
<index name="idx_brand_image_brand_id">
<index-column name="brand_id" />
</index>
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
</behavior>
</table> </table>

View File

@@ -0,0 +1 @@
{include file="includes/tinymce_init.tpl"}

View File

@@ -1289,7 +1289,8 @@ INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES
(31, 'admin.configuration.advanced', NOW(), NOW()), (31, 'admin.configuration.advanced', NOW(), NOW()),
(32, 'admin.configuration.translations', NOW(), NOW()), (32, 'admin.configuration.translations', NOW(), NOW()),
(33, 'admin.export', NOW(), NOW()), (33, 'admin.export', NOW(), NOW()),
(34, 'admin.tools', NOW(), NOW()); (34, 'admin.tools', NOW(), NOW()),
(35, 'admin.brand', NOW(), NOW());
/** /**
generated with command : php Thelia thelia:generate-resources --output sql-i18n generated with command : php Thelia thelia:generate-resources --output sql-i18n

File diff suppressed because it is too large Load Diff

View File

@@ -46,7 +46,104 @@ CREATE TABLE `order_version`
) ENGINE=InnoDB CHARACTER SET='utf8'; ) ENGINE=InnoDB CHARACTER SET='utf8';
# Add missing columns to coupon (version_created_at, version_created_by) # Add missing columns to coupon (version_created_at, version_created_by)
ALTER TABLE `order` ADD `version_created_at` DATE AFTER `version`; ALTER TABLE `coupon` ADD `version_created_at` DATE AFTER `version`;
ALTER TABLE `order` ADD `version_created_by` VARCHAR(100) AFTER `version_created_at`; ALTER TABLE `coupon` ADD `version_created_by` VARCHAR(100) AFTER `version_created_at`;
# Add the "brand" resource
INSERT INTO resource (`code`, `created_at`, `updated_at`) VALUES ('admin.brand', NOW(), NOW());
# Add Brand tables
-- ---------------------------------------------------------------------
-- brand
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `brand`;
CREATE TABLE `brand`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`visible` TINYINT,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
`meta_title` VARCHAR(255),
`meta_description` TEXT,
`meta_keywords` TEXT,
`logo_image_id` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `fk_brand_brand_image1_idx` (`logo_image_id`),
CONSTRAINT `fk_logo_image_id_brand_image`
FOREIGN KEY (`logo_image_id`)
REFERENCES `brand_image` (`id`)
ON UPDATE RESTRICT
ON DELETE SET NULL
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- brand_document
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `brand_document`;
CREATE TABLE `brand_document`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`brand_id` INTEGER NOT NULL,
`file` VARCHAR(255) NOT NULL,
`position` INTEGER,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_brand_document_brand_id` (`brand_id`),
CONSTRAINT `fk_brand_document_brand_id`
FOREIGN KEY (`brand_id`)
REFERENCES `brand` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- brand_image
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `brand_image`;
CREATE TABLE `brand_image`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`brand_id` INTEGER NOT NULL,
`file` VARCHAR(255) NOT NULL,
`position` INTEGER,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_brand_image_brand_id` (`brand_id`),
INDEX `idx_brand_image_brand_id_is_brand_logo` (`brand_id`),
CONSTRAINT `fk_brand_image_brand_id`
FOREIGN KEY (`brand_id`)
REFERENCES `brand` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------
-- Add brand field to product table, and related constraint.
-- ---------------------------------------------------------
ALTER TABLE `product` ADD `brand_id` INTEGER DEFAULT 0 AFTER `template_id`;
ALTER TABLE `product` ADD CONSTRAINT `fk_product_brand` FOREIGN KEY (`brand_id`) REFERENCES `brand` (`id`) ON DELETE SET NULL;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,178 @@
{extends file="admin-layout.tpl"}
{block name="no-return-functions"}
{$admin_current_location = 'tools'}
{/block}
{block name="check-resource"}admin.brand{/block}
{block name="check-access"}view{/block}
{block name="page-title"}{intl l='Edit brand'}{/block}
{block name="main-content"}
<div class="brand edit-brand">
<div id="wrapper" class="container">
{loop name="brand_edit" type="brand" visible="*" id="{$brand_id}" backend_context="1" lang="$edit_language_id"}
<nav>
<ul class="breadcrumb">
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
<li><a href="{url path='admin/tools'}">{intl l='Tools'}</a></li>
<li><a href="{url path='admin/brand'}">{intl l='Brands'}</a></li>
<li>{intl l='Editing brand "%title"' title="$TITLE"}</li>
</ul>
</nav>
<div class="row">
<div class="col-md-12 general-block-decorator">
<div class="row">
<div class="col-md-7 title">
{intl l='Edit brand %title' title={$TITLE}}
</div>
</div>
<div class="row">
<div class="col-md-12">
<ul class="nav nav-tabs" id="tabbed-menu">
<li class="active">
<a href="#general" data-toggle="tab">{intl l="General description"}</a>
</li>
<li><a href="#seo" data-toggle="tab">{intl l="SEO"}</a></li>
<li><a href="#images" data-toggle="tab">{intl l="Images"}</a></li>
<li><a href="#documents" data-toggle="tab">{intl l="Documents"}</a></li>
<li><a href="#modules" data-toggle="tab">{intl l="Modules"}</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="general">
<div class="form-container">
{form name="thelia.admin.brand.modification"}
<form method="POST" action="{url path="/admin/brand/save/{$ID}"}" {form_enctype form=$form} class="clearfix">
{include file="includes/inner-form-toolbar.html" close_url={url path='/admin/brand'}}
<input type="hidden" name="current_tab" value="general"/>
{* Be sure to get the currency ID, even if the form could not be validated *}
<input type="hidden" name="brand_id" value="{$ID}" />
{form_hidden_fields form=$form}
{admin_form_field form=$form name="success_url" value={url path="/admin/brand/update/{$ID}"}}
{admin_form_field form=$form name="locale" value={$edit_language_locale}}
{if $form_error}
<div class="alert alert-danger">{$form_error_message}</div>
{/if}
<div class="row">
<div class="col-md-8">
{include file="includes/standard-description-form-fields.html"}
</div>
<div class="col-md-4">
{admin_form_field form=$form name="visible"}
</div>
</div>
{include
file="includes/inner-form-toolbar.html"
hide_submit_buttons = false
hide_flags = true
close_url={url path="/admin/brand"}
}
<small>{intl l='Brand created on %date_create. Last modification: %date_change' date_create={format_date date=$CREATE_DATE} date_change={format_date date=$UPDATE_DATE} }</small>
</form>
{/form}
</div>
</div>
<div class="tab-pane fade" id="seo">
{form name="thelia.admin.seo"}
{include
file = "includes/seo-tab.html"
form = $form
formAction = {url path='/admin/brand/seo/save'}
closeUrl = {url path='/admin/brand'}
current_id = $brand_id
}
{/form}
</div>
<div class="tab-pane fade" id="images">
{include file='includes/image-upload-form.html' imageType='brand' parentId=$brand_id}
</div>
<div class="tab-pane fade" id="documents">
{include file='includes/document-upload-form.html' documentType='brand' parentId=$brand_id}
</div>
<div class="tab-pane fade" id="modules">
<div class="form-container">
{include
file = "includes/inner-form-toolbar.html"
hide_submit_buttons = true
page_url = {$pageUrl}
close_url = {$closeUrl}
current_tab = "modules"
}
</div>
{include file="includes/module-tab-content.html" location="brand-edit"}
</div>
</div>
</div>
</div>
</div>
</div>
{/loop}
</div>
</div>
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/dropzone.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/image-upload.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/document-upload.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/jquery-ui-1.10.3.custom.min.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(function() {
// Load active tab
$.imageUploadManager.initImageDropZone();
$.documentUploadManager.initDocumentDropZone();
$('.use_default_rewriten_url').click(function(ev) {
alert("Not functionnal");
ev.preventDefault();
});
// Show proper tab, if defined
{if ! empty($current_tab)}
$('.nav-tabs a[href="#{$current_tab}"]').trigger("click");
{/if}
});
</script>
{/block}
{block name="javascript-last-call"}
{module_include location='brand-edit-js'}
{/block}

View File

@@ -0,0 +1,304 @@
{extends file="admin-layout.tpl"}
{block name="no-return-functions"}
{$admin_current_location = 'tools'}
{/block}
{block name="page-title"}{intl l='Brands'}{/block}
{block name="check-resource"}admin.brand{/block}
{block name="check-access"}view{/block}
{block name="main-content"}
<div class="brands">
<div id="wrapper" class="container">
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/tools'}">{intl l="Tools"}</a></li>
<li><a href="{url path='/admin/brand'}">{intl l="Brands"}</a></li>
</ul>
{module_include location='brands_top'}
<div class="row">
<div class="col-md-12">
<div class="general-block-decorator">
<div class="table-responsive">
<table class="table table-striped table-condensed">
<caption class="clearfix">
{intl l='Brands'}
{loop type="auth" name="can_create" role="ADMIN" resource="admin.brand" access="CREATE"}
<span class="pull-right">
<a class="btn btn-default btn-primary" title="{intl l='Add a new brand'}" href="#creation_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-plus-sign"></span>
</a>
</span>
{/loop}
</caption>
<thead>
<tr>
<th>
{admin_sortable_header
current_order=$order
order='id'
reverse_order='id-reverse'
path='/admin/brands'
label="{intl l='ID'}"
}
</th>
<th>&nbsp;</th>
<th>
{admin_sortable_header
current_order=$order
order='alpha'
reverse_order='alpha-reverse'
path='/admin/brand'
label="{intl l='Name'}"
}
</th>
<th class="text-center">
{admin_sortable_header
current_order=$order
order='manual'
reverse_order='manual-reverse'
path='/admin/brand'
label="{intl l="Position"}"
}
</th>
<th class="text-center">
{admin_sortable_header
current_order=$content_order
order='visible'
reverse_order='visible-reverse'
path={url path='/admin/brand'}
label="{intl l='Online'}"
}
</th>
{module_include location='brands_table_header'}
<th class="actions">{intl l='Actions'}</th>
</tr>
</thead>
<tbody>
{loop name="brands" type="brand" visible="*" backend_context="1" lang=$lang_id order=$order}
<tr>
<td>{$ID}</td>
<td>
{loop type="image" name="folder_image" source="brand" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
<a href="{url path="admin/brand/update/$OBJECT_ID"}" title="{intl l='Edit this brand'}">
<img src="{$IMAGE_URL}" alt="{$TITLE}" />
</a>
{/loop}
</td>
<td>
{loop type="auth" name="can_change" role="ADMIN" resource="admin.brand" access="UPDATE"}
<a title="{intl l='Change this brand'}" href="{url path="/admin/brand/update/$ID"}">{$TITLE}</a>
{/loop}
{elseloop rel="can_change"}
{$TITLE}
{/elseloop}
</td>
<td class="text-center">
{admin_position_block
resource="admin.brand"
access="UPDATE"
path="/admin/brand/update-position"
url_parameter="brand_id"
in_place_edit_class="brandPositionChange"
position="$POSITION"
id="$ID"
}
</td>
<td class="text-center">
{loop type="auth" name="can_change" role="ADMIN" resource="admin.brand" access="UPDATE"}
<div class="make-switch switch-small visibleToggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input type="checkbox" class="visibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
</div>
{/loop}
{elseloop rel="can_change"}
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input type="checkbox" class="disabled" disabled="disabled" {if $VISIBLE == 1}checked="checked"{/if}>
</div>
{/elseloop}
</td>
{module_include location='brands_table_row'}
<td class="actions">
<div class="btn-group">
{loop type="auth" name="can_change" role="ADMIN" resource="admin.brand" access="UPDATE"}
<a class="btn btn-default btn-xs brand-change" title="{intl l='Change this brand'}" href="{url path="/admin/brand/update/$ID"}">
<span class="glyphicon glyphicon-edit"></span>
</a>
{/loop}
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.brand" access="DELETE"}
<a class="btn btn-default btn-xs brand-delete" title="{intl l='Delete this brand'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
{/loop}
</div>
</td>
</tr>
{/loop}
{elseloop rel="brands"}
<tr>
<td colspan="8">
<div class="alert alert-info">
{intl l="No brand has been created yet. Click the + button to create one."}
</div>
</td>
</tr>
{/elseloop}
</tbody>
</table>
</div>
</div>
</div>
</div>
{module_include location='brands_bottom'}
</div>
</div>
{* Adding a new brand *}
{form name="thelia.admin.brand.creation"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "creation_dialog"}
{form_hidden_fields form=$form}
{loop type="lang" name="default-lang" default_only="1"}
{* Switch edition to the current locale *}
<input type="hidden" name="edit_language_id" value="{$ID}" />
{admin_form_field form=$form name="locale" value=$LOCALE}
{/loop}
{admin_form_field form=$form name="success_url" value={url path='/admin/brand/update/_ID_'}}
{admin_form_field form=$form name="title"}
{admin_form_field form=$form name="visible"}
{module_include location='brand_create_form'}
{/capture}
{include
file = "includes/generic-create-dialog.html"
dialog_id = "creation_dialog"
dialog_title = {intl l="Create a new brand"}
dialog_body = {$smarty.capture.creation_dialog nofilter}
dialog_ok_label = {intl l="Create this brand"}
form_action = {url path='/admin/brand/create'}
form_enctype = {form_enctype form=$form}
form_error_message = $form_error_message
}
{/form}
{* Delete confirmation dialog *}
{capture "delete_dialog"}
<input type="hidden" name="brand_id" id="brand_delete_id" value="" />
{module_include location='brand_delete_form'}
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "delete_dialog"
dialog_title = {intl l="Delete brand"}
dialog_message = {intl l="Do you really want to delete this brand ?"}
form_action = {url path='/admin/brand/delete'}
form_content = {$smarty.capture.delete_dialog nofilter}
}
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(function() {
// Set proper brand ID in delete from
$('a.brand-delete').click(function(ev) {
$('#brand_delete_id').val($(this).data('id'));
});
// JS stuff for creation form
{include
file = "includes/generic-js-dialog.html"
dialog_id = "creation_dialog"
form_name = "thelia.admin.brand.creation"
}
{* Inline editing of object position using bootstrap-editable *}
$('.brandPositionChange').editable({
type : 'text',
title : '{intl l="Enter new brand position"}',
mode : 'popup',
inputclass : 'input-mini',
placement : 'left',
success : function(response, newValue) {
// The URL template
var url = "{url noamp='1' path='/admin/brand/update-position' brand_id='__ID__' position='__POS__'}";
// Perform subtitutions
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);
// Reload the page
location.href = url;
}
});
{* Visibility toggle *}
$(".visibleToggle").on('switch-change', function(event, data) {
$.ajax({
url : "{url path='admin/brand/toggle-online'}",
data : {
brand_id : $(this).data('id'),
action : 'visibilityToggle'
}
});
});
});
</script>
{/block}
{block name="javascript-last-call"}
{module_include location='brands-js'}
{/block}

View File

@@ -40,6 +40,13 @@
</tr> </tr>
{/loop} {/loop}
{loop name="auth-export" type="auth" role="ADMIN" resource="admin.brand" access="VIEW"}
<tr>
<td><a href="{url path='/admin/brand'}">{intl l="Brands"}</a></td>
<td><a class="btn btn-default btn-xs" href="{url path='/admin/brand'}"><i class="glyphicon glyphicon-edit"></i></a></td>
</tr>
{/loop}
{loop name="auth-export" type="auth" role="ADMIN" resource="admin.export" access="VIEW"} {loop name="auth-export" type="auth" role="ADMIN" resource="admin.export" access="VIEW"}
<tr> <tr>
<td><a href="{url path='/admin/export'}">{intl l="Export"}</a></td> <td><a href="{url path='/admin/export'}">{intl l="Export"}</a></td>