Implemented "Remember Me" feature on admin. Started template management

This commit is contained in:
franck
2013-09-16 09:23:44 +02:00
parent 9cdf1a0376
commit 71c1cee66d
91 changed files with 16722 additions and 3088 deletions

View File

@@ -39,6 +39,8 @@ use Thelia\Model\AttributeAvQuery;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\CategoryEvent;
use Thelia\Core\Event\AttributeEvent;
use Thelia\Model\AttributeTemplate;
use Thelia\Model\AttributeTemplateQuery;
class Attribute extends BaseAction implements EventSubscriberInterface
{
@@ -137,10 +139,10 @@ class Attribute extends BaseAction implements EventSubscriberInterface
public function addToAllTemplates(AttributeEvent $event)
{
$templates = ProductTemplateAttributeQuery::create()->find();
$templates = AttributeTemplateQuery::create()->find();
foreach($templates as $template) {
$pat = new ProductTemplateAttribute();
$pat = new AttributeTemplate();
$pat->setTemplate($template->getId())
->setAttributeId($event->getAttribute()->getId())
@@ -151,7 +153,7 @@ class Attribute extends BaseAction implements EventSubscriberInterface
public function removeFromAllTemplates(AttributeEvent $event)
{
// Delete this attribute from all product templates
ProductTemplateAttributeQuery::create()->filterByAttributeId($event->getAttribute()->getId())->delete();
AttributeTemplateQuery::create()->filterByAttributeId($event->getAttribute()->getId())->delete();
}
/**

View File

@@ -0,0 +1,127 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Model\TemplateQuery;
use Thelia\Model\Template as TemplateModel;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\TemplateUpdateEvent;
use Thelia\Core\Event\TemplateCreateEvent;
use Thelia\Core\Event\TemplateDeleteEvent;
use Thelia\Model\ConfigQuery;
use Thelia\Model\TemplateAv;
use Thelia\Model\TemplateAvQuery;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\CategoryEvent;
use Thelia\Core\Event\TemplateEvent;
use Thelia\Model\TemplateTemplate;
use Thelia\Model\TemplateTemplateQuery;
use Thelia\Model\ProductQuery;
class Template extends BaseAction implements EventSubscriberInterface
{
/**
* Create a new template entry
*
* @param TemplateCreateEvent $event
*/
public function create(TemplateCreateEvent $event)
{
$template = new TemplateModel();
$template
->setDispatcher($this->getDispatcher())
->setLocale($event->getLocale())
->setName($event->getTemplateName())
->save()
;
$event->setTemplate($template);
}
/**
* Change a product template
*
* @param TemplateUpdateEvent $event
*/
public function update(TemplateUpdateEvent $event)
{
$search = TemplateQuery::create();
if (null !== $template = TemplateQuery::create()->findPk($event->getTemplateId())) {
$template
->setDispatcher($this->getDispatcher())
->setLocale($event->getLocale())
->setName($event->getTemplateName())
->save();
$event->setTemplate($template);
}
}
/**
* Delete a product template entry
*
* @param TemplateDeleteEvent $event
*/
public function delete(TemplateDeleteEvent $event)
{
if (null !== ($template = TemplateQuery::create()->findPk($event->getTemplateId()))) {
// Check if template is used by a product
$product_count = ProductQuery::create()->findByTemplateId($template->getId())->count();
if ($product_count <= 0) {
$template
->setDispatcher($this->getDispatcher())
->delete()
;
}
$event->setTemplate($template);
$event->setProductCount($product_count);
}
}
/**
* {@inheritDoc}
*/
public static function getSubscribedEvents()
{
return array(
TheliaEvents::TEMPLATE_CREATE => array("create", 128),
TheliaEvents::TEMPLATE_UPDATE => array("update", 128),
TheliaEvents::TEMPLATE_DELETE => array("delete", 128),
);
}
}

View File

@@ -57,6 +57,11 @@
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.template" class="Thelia\Action\Template">
<argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.attribute" class="Thelia\Action\Attribute">
<argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/>

View File

@@ -36,6 +36,7 @@
<loop class="Thelia\Core\Template\Loop\Coupon" name="coupon"/>
<loop class="Thelia\Core\Template\Loop\Message" name="message"/>
<loop class="Thelia\Core\Template\Loop\Delivery" name="delivery"/>
<loop class="Thelia\Core\Template\Loop\Template" name="template"/> <!-- This is product templates ;-) -->
</loops>
<forms>
@@ -72,6 +73,10 @@
<form name="thelia.admin.attribute.modification" class="Thelia\Form\AttributeModificationForm"/>
<form name="thelia.admin.attributeav.creation" class="Thelia\Form\AttributeAvCreationForm"/>
<form name="thelia.admin.template.creation" class="Thelia\Form\TemplateCreationForm"/>
<form name="thelia.admin.template.modification" class="Thelia\Form\TemplateModificationForm"/>
</forms>

View File

@@ -210,6 +210,29 @@
</route>
<!-- Product templates management -->
<route id="admin.configuration.templates.default" path="/admin/configuration/templates">
<default key="_controller">Thelia\Controller\Admin\TemplateController::defaultAction</default>
</route>
<route id="admin.configuration.templates.create" path="/admin/configuration/templates/create">
<default key="_controller">Thelia\Controller\Admin\TemplateController::createAction</default>
</route>
<route id="admin.configuration.templates.update" path="/admin/configuration/templates/update">
<default key="_controller">Thelia\Controller\Admin\TemplateController::updateAction</default>
</route>
<route id="admin.configuration.templates.save" path="/admin/configuration/templates/save">
<default key="_controller">Thelia\Controller\Admin\TemplateController::processUpdateAction</default>
</route>
<route id="admin.configuration.templates.delete" path="/admin/configuration/templates/delete">
<default key="_controller">Thelia\Controller\Admin\TemplateController::deleteAction</default>
</route>
<!-- attribute and attributes value management -->
<route id="admin.configuration.attributes.default" path="/admin/configuration/attributes">

View File

@@ -210,31 +210,34 @@ abstract class AbstractCrudController extends BaseAdminController
/**
* Put in this method post object creation processing if required.
*
* @param unknown $createdObject the created object
* @param unknown $createEvent the create event
* @return Response a response, or null to continue normal processing
*/
protected function performAdditionalCreateAction($createdObject)
protected function performAdditionalCreateAction($createEvent)
{
// Nothing to do
return null;
}
/**
* Put in this method post object update processing if required.
*
* @param unknown $updatedObject the updated object
* @param unknown $updateEvent the update event
* @return Response a response, or null to continue normal processing
*/
protected function performAdditionalUpdateAction($updatedObject)
protected function performAdditionalUpdateAction($updateeEvent)
{
// Nothing to do
return null;
}
/**
* Put in this method post object delete processing if required.
*
* @param unknown $deletedObject the deleted object
* @param unknown $deleteEvent the delete event
* @return Response a response, or null to continue normal processing
*/
protected function performAdditionalDeleteAction($deletedObject)
protected function performAdditionalDeleteAction($deleteEvent)
{
// Nothing to do
return null;
}
/**
@@ -306,7 +309,7 @@ abstract class AbstractCrudController extends BaseAdminController
$this->adminLogAppend(sprintf("%s %s (ID %s) created", ucfirst($this->objectName), $this->getObjectLabel($createdObject), $this->getObjectId($createdObject)));
}
$this->performAdditionalCreateAction($createdObject);
$this->performAdditionalCreateAction($createEvent);
// Substitute _ID_ in the URL with the ID of the created object
$successUrl = str_replace('_ID_', $this->getObjectId($createdObject), $creationForm->getSuccessUrl());
@@ -393,7 +396,7 @@ abstract class AbstractCrudController extends BaseAdminController
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
}
$this->performAdditionalUpdateAction($changedObject);
$this->performAdditionalUpdateAction($changeEvent);
// If we have to stay on the same page, do not redirect to the succesUrl,
// just redirect to the edit page again.
@@ -494,8 +497,12 @@ abstract class AbstractCrudController extends BaseAdminController
$this->adminLogAppend(
sprintf("%s %s (ID %s) deleted", ucfirst($this->objectName), $this->getObjectLabel($deletedObject), $this->getObjectId($deletedObject)));
}
$this->performAdditionalDeleteAction($deletedObject);
$this->redirectToListTemplate();
$response = $this->performAdditionalDeleteAction($deleteEvent);
if ($response == null)
$this->redirectToListTemplate();
else
return $response;
}
}

View File

@@ -23,6 +23,10 @@
namespace Thelia\Controller\Admin;
use Thelia\Core\Security\Authentication\AdminTokenAuthenticator;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Security\Exception\TokenAuthenticationException;
class AdminController extends BaseAdminController
{
public function indexAction()

View File

@@ -107,7 +107,7 @@ class AttributeController extends AbstractCrudController
*
* @see \Thelia\Controller\Admin\AbstractCrudController::performAdditionalUpdateAction()
*/
protected function performAdditionalUpdateAction($updatedObject)
protected function performAdditionalUpdateAction($updateEvent)
{
$attr_values = $this->getRequest()->get('attribute_values', null);
@@ -123,6 +123,8 @@ class AttributeController extends AbstractCrudController
$this->dispatch(TheliaEvents::ATTRIBUTE_AV_UPDATE, $event);
}
}
return null;
}
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)

View File

@@ -40,6 +40,8 @@ use Thelia\Form\BaseForm;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Log\Tlog;
use Symfony\Component\Routing\Router;
use Thelia\Model\Admin;
use Thelia\Core\Security\Token\CookieTokenProvider;
class BaseAdminController extends BaseController
{
@@ -302,6 +304,46 @@ class BaseAdminController extends BaseController
return $order;
}
/**
* Create the remember me cookie for the given user.
*/
protected function createAdminRememberMeCookie(Admin $user)
{
$ctp = new CookieTokenProvider();
$cookieName = ConfigQuery::read('admin_remember_me_cookie_name', 'armcn');
$cookieExpiration = ConfigQuery::read('admin_remember_me_cookie_expiration', 2592000 /* 1 month */);
$ctp->createCookie($user, $cookieName, $cookieExpiration);
}
/**
* Get the rememberme key from the cookie.
*
* @return string hte key found, or null if no key was found.
*/
protected function getRememberMeKeyFromCookie()
{
// Check if we can authenticate the user with a cookie-based token
$cookieName = ConfigQuery::read('admin_remember_me_cookie_name', 'armcn');
$ctp = new CookieTokenProvider();
return $ctp->getKeyFromCookie($this->getRequest(), $cookieName);
}
/** Clear the remember me cookie.
*
*/
protected function clearRememberMeCookie() {
$ctp = new CookieTokenProvider();
$cookieName = ConfigQuery::read('admin_remember_me_cookie_name', 'armcn');
$ctp->clearCookie($cookieName);
}
/**
* Render the given template, and returns the result as an Http Response.
*

View File

@@ -30,11 +30,44 @@ use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Tools\URL;
use Thelia\Tools\Redirect;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Security\Authentication\AdminTokenAuthenticator;
use Thelia\Core\Security\UserProvider\TokenProvider;
use Symfony\Component\HttpFoundation\Cookie;
use Thelia\Core\Security\UserProvider\CookieTokenProvider;
use Thelia\Core\Security\Exception\TokenAuthenticationException;
class SessionController extends BaseAdminController
{
public function showLoginAction()
{
// Check if we can authenticate the user with a cookie-based token
if (null !== $key = $this->getRememberMeKeyFromCookie()) {
// Create the authenticator
$authenticator = new AdminTokenAuthenticator($key);
try {
// If have found a user, store it in the security context
$user = $authenticator->getAuthentifiedUser();
$this->getSecurityContext()->setAdminUser($user);
$this->adminLogAppend("Successful token authentication");
// Update the cookie
$cookie = $this->createAdminRememberMeCookie($user);
// Render the home page
return $this->render("home");
}
catch (TokenAuthenticationException $ex) {
$this->adminLogAppend("Token based authentication failed.");
// Clear the cookie
$this->clearRememberMeCookie();
}
}
return $this->render("login");
}
@@ -44,6 +77,9 @@ class SessionController extends BaseAdminController
$this->getSecurityContext()->clearAdminUser();
// Clear the remember me cookie, if any
$this->clearRememberMeCookie();
// Go back to login page.
$this->redirectToRoute('admin.login');
}
@@ -68,10 +104,19 @@ class SessionController extends BaseAdminController
// Log authentication success
AdminLog::append("Authentication successful", $request, $user);
/**
* FIXME: we have tou find a way to send cookie
*/
if (intval($adminLoginForm->getForm()->get('remember_me')->getData()) > 0) {
// If a remember me field if present and set in the form, create
// the cookie thant store "remember me" information
$this->createAdminRememberMeCookie($user);
}
$this->dispatch(TheliaEvents::ADMIN_LOGIN);
// Redirect to the success URL
return Redirect::exec($adminLoginForm->getSuccessUrl());
// Redirect to the success URL, passing the cookie if one exists.
$this->redirect($adminLoginForm->getSuccessUrl());
} catch (FormValidationException $ex) {

View File

@@ -0,0 +1,196 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
use Thelia\Core\Event\TemplateDeleteEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\TemplateUpdateEvent;
use Thelia\Core\Event\TemplateCreateEvent;
use Thelia\Model\TemplateQuery;
use Thelia\Form\TemplateModificationForm;
use Thelia\Form\TemplateCreationForm;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Model\TemplateAv;
use Thelia\Model\TemplateAvQuery;
use Thelia\Core\Event\TemplateAvUpdateEvent;
use Thelia\Core\Event\TemplateEvent;
/**
* Manages templates sent by mail
*
* @author Franck Allimant <franck@cqfdev.fr>
*/
class TemplateController extends AbstractCrudController
{
public function __construct()
{
parent::__construct(
'template',
null,
null,
'admin.configuration.templates.view',
'admin.configuration.templates.create',
'admin.configuration.templates.update',
'admin.configuration.templates.delete',
TheliaEvents::TEMPLATE_CREATE,
TheliaEvents::TEMPLATE_UPDATE,
TheliaEvents::TEMPLATE_DELETE,
null, // No visibility toggle
null // No position update
);
}
protected function getCreationForm()
{
return new TemplateCreationForm($this->getRequest());
}
protected function getUpdateForm()
{
return new TemplateModificationForm($this->getRequest());
}
protected function getCreationEvent($formData)
{
$createEvent = new TemplateCreateEvent();
$createEvent
->setTemplateName($formData['name'])
->setLocale($formData["locale"])
;
return $createEvent;
}
protected function getUpdateEvent($formData)
{
$changeEvent = new TemplateUpdateEvent($formData['id']);
// Create and dispatch the change event
$changeEvent
->setLocale($formData["locale"])
->setTemplateName($formData['name'])
;
// Add feature and attributes list
return $changeEvent;
}
protected function getDeleteEvent()
{
return new TemplateDeleteEvent($this->getRequest()->get('template_id'));
}
protected function eventContainsObject($event)
{
return $event->hasTemplate();
}
protected function hydrateObjectForm($object)
{
$data = array(
'id' => $object->getId(),
'locale' => $object->getLocale(),
'name' => $object->getName()
);
// Setup the object form
return new TemplateModificationForm($this->getRequest(), "form", $data);
}
protected function getObjectFromEvent($event)
{
return $event->hasTemplate() ? $event->getTemplate() : null;
}
protected function getExistingObject()
{
return TemplateQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('template_id'));
}
protected function getObjectLabel($object)
{
return $object->getName();
}
protected function getObjectId($object)
{
return $object->getId();
}
protected function renderListTemplate($currentOrder)
{
return $this->render('templates', array('order' => $currentOrder));
}
protected function renderEditionTemplate()
{
return $this->render(
'template-edit',
array(
'template_id' => $this->getRequest()->get('template_id'),
)
);
}
protected function redirectToEditionTemplate()
{
$this->redirectToRoute(
"admin.configuration.templates.update",
array(
'template_id' => $this->getRequest()->get('template_id'),
)
);
}
protected function redirectToListTemplate()
{
$this->redirectToRoute('admin.configuration.templates.default');
}
// Process delete failure, which may occurs if template is in use.
protected function performAdditionalDeleteAction($deleteEvent)
{
if ($deleteEvent->getProductCount() > 0) {
$this->getParserContext()->setGeneralError(
$this->getTranslator()->trans(
"This template is in use in some of your products, and cannot be deleted. Delete it from all your products and try again."
)
);
return $this->renderList();
}
// Normal delete processing
return null;
}
}

View File

@@ -198,9 +198,9 @@ class BaseController extends ContainerAware
*
* @param string $url
*/
public function redirect($url, $status = 302)
public function redirect($url, $status = 302, $cookies = array())
{
Redirect::exec($url, $status);
Redirect::exec($url, $status, $cookies);
}
/**

View File

@@ -0,0 +1,54 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
class TemplateCreateEvent extends TemplateEvent
{
protected $template_name;
protected $locale;
public function getLocale()
{
return $this->locale;
}
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
public function getTemplateName()
{
return $this->template_name;
}
public function setTemplateName($template_name)
{
$this->template_name = $template_name;
return $this;
}
}

View File

@@ -0,0 +1,59 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
class TemplateDeleteEvent extends TemplateEvent
{
protected $template_id;
protected $product_count;
public function __construct($template_id)
{
$this->setTemplateId($template_id);
}
public function getTemplateId()
{
return $this->template_id;
}
public function setTemplateId($template_id)
{
$this->template_id = $template_id;
return $this;
}
public function getProductCount()
{
return $this->product_count;
}
public function setProductCount($product_count)
{
$this->product_count = $product_count;
return $this;
}
}

View File

@@ -0,0 +1,52 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Template;
class TemplateEvent extends ActionEvent
{
protected $template = null;
public function __construct(Template $template = null)
{
$this->template = $template;
}
public function hasTemplate()
{
return ! is_null($this->template);
}
public function getTemplate()
{
return $this->template;
}
public function setTemplate($template)
{
$this->template = $template;
return $this;
}
}

View File

@@ -0,0 +1,71 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
class TemplateUpdateEvent extends TemplateCreateEvent
{
protected $template_id;
protected $feature_list;
protected $attribute_list;
public function __construct($template_id)
{
$this->setTemplateId($template_id);
}
public function getTemplateId()
{
return $this->template_id;
}
public function setTemplateId($template_id)
{
$this->template_id = $template_id;
return $this;
}
public function getFeatureList()
{
return $this->feature_list;
}
public function setFeatureList($feature_list)
{
$this->feature_list = $feature_list;
return $this;
}
public function getAttributeList()
{
return $this->attribute_list;
}
public function setAttributeList($attribute_list)
{
$this->attribute_list = $attribute_list;
return $this;
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\Authentication;
use Thelia\Core\Security\UserProvider\AdminTokenUserProvider;
class AdminTokenAuthenticator extends TokenAuthenticator
{
public function __construct($key)
{
parent::__construct(
$key,
new AdminTokenUserProvider()
);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\Authentication;
use Thelia\Core\Security\UserProvider\CustomerTokenUserProvider;
class CustomerTokenAuthenticator extends TokenAuthenticator
{
public function __construct($key)
{
parent::__construct(
$key,
new CustomerTokenUserProvider()
);
}
}

View File

@@ -0,0 +1,57 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\Authentication;
use Thelia\Core\Security\Authentication\AuthenticatorInterface;
use Thelia\Core\Security\UserProvider\UserProviderInterface;
use Thelia\Core\Security\UserProvider\TokenUserProvider;
use Thelia\Core\Security\Exception\TokenAuthenticationException;
class TokenAuthenticator implements AuthenticatorInterface
{
protected $key;
protected $userProvider;
public function __construct($key, TokenUserProvider $userProvider)
{
$this->key = $key;
$this->userProvider = $userProvider;
}
/**
* @see \Thelia\Core\Security\Authentication\AuthenticatorInterface::getAuthentifiedUser()
*/
public function getAuthentifiedUser()
{
$keyData = $this->userProvider->decodeKey($this->key);
$user = $this->userProvider->getUser($keyData);
if ($user === null) throw new TokenAuthenticationException("No user matches the provided token");
return $user;
}
}

View File

@@ -0,0 +1,28 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\Exception;
class TokenAuthenticationException extends \Exception
{
}

View File

@@ -0,0 +1,55 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\Token;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Security\User\UserInterface;
class CookieTokenProvider
{
public function getKeyFromCookie(Request $request, $cookieName)
{
if ($request->cookies->has($cookieName)) {
// Create the authenticator
return $request->cookies->get($cookieName);
}
return null;
}
public function createCookie(UserInterface $user, $cookieName, $cookieExpires)
{
$tokenProvider = new TokenProvider();
$key = $tokenProvider->encodeKey($user);
setcookie($cookieName, $key, time() + $cookieExpires, '/');
}
public function clearCookie($cookieName)
{
setcookie($cookieName, '', time() - 3600, '/');
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Thelia\Core\Security\Token;
use Thelia\Core\Security\User\UserInterface;
class TokenProvider
{
public function encodeKey(UserInterface $user) {
// Always set a new token in the user environment
$user->setToken(uniqid());
return base64_encode(serialize(
array($user->getUsername(), $user->getToken(), $user->getSerial())));
}
public function decodeKey($key) {
$data = unserialize(base64_decode($key));
return array(
'username' => $data[0],
'token' => $data[1],
'serial' => $data[2]
);
}
}

View File

@@ -48,4 +48,24 @@ interface UserInterface
* @return void
*/
public function eraseCredentials();
}
/**
* return the user token (used by remember me authnetication system)
*/
public function getToken();
/**
* Set a token in the user data (used by remember me authnetication system)
*/
public function setToken($token);
/**
* return the user serial (used by remember me authnetication system)
*/
public function getSerial();
/**
* Set a serial number int the user data (used by remember me authnetication system)
*/
public function setSerial($serial);
}

View File

@@ -0,0 +1,39 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
use Thelia\Model\Admin;
use Thelia\Model\AdminQuery;
class AdminTokenUserProvider extends TokenUserProvider
{
public function getUser($dataArray) {
return AdminQuery::create()
->filterByLogin($dataArray['username'])
->filterByRememberMeSerial($dataArray['serial'])
->filterByRememberMeToken($dataArray['token'])
->findOne();
}
}

View File

@@ -1,4 +1,26 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
use Thelia\Model\Admin;

View File

@@ -0,0 +1,39 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
use Thelia\Action\Customer;
use Thelia\Model\CustomerQuery;
class CustomerTokenUserProvider extends TokenUserProvider
{
public function getUser($dataArray) {
return CustomerQuery::create()
->filterByEmail($dataArray['username'])
->filterByRememberMeSerial($dataArray['serial'])
->filterByRememberMeToken($dataArray['token'])
->findOne();
}
}

View File

@@ -1,4 +1,26 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
use Thelia\Action\Customer;
@@ -13,4 +35,4 @@ class CustomerUserProvider implements UserProviderInterface
return $customer;
}
}
}

View File

@@ -0,0 +1,32 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
use Thelia\Core\Security\User\UserInterface;
use Thelia\Core\Security\Token\TokenProvider;
abstract class TokenUserProvider extends TokenProvider implements UserProviderInterface
{
public abstract function getUser($key);
}

View File

@@ -1,4 +1,25 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;

View File

@@ -38,6 +38,9 @@ use Thelia\Model\Map\ProductCategoryTableMap;
use Thelia\Type\TypeCollection;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
use Thelia\Model\ProductQuery;
use Thelia\Model\TemplateQuery;
use Thelia\Model\AttributeTemplateQuery;
/**
*
@@ -60,8 +63,7 @@ class Attribute extends BaseI18nLoop
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createIntListTypeArgument('product'),
Argument::createIntListTypeArgument('category'),
Argument::createBooleanOrBothTypeArgument('visible', 1),
Argument::createIntListTypeArgument('template'),
Argument::createIntListTypeArgument('exclude'),
new Argument(
'order',
@@ -101,26 +103,23 @@ class Attribute extends BaseI18nLoop
$search->filterById($exclude, Criteria::NOT_IN);
}
$visible = $this->getVisible();
if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible);
$product = $this->getProduct();
$category = $this->getCategory();
$template = $this->getTemplate();
if (null !== $product) {
$productCategories = ProductCategoryQuery::create()->select(array(ProductCategoryTableMap::CATEGORY_ID))->filterByProductId($product, Criteria::IN)->find()->getData();
// Find the template assigned to the product.
$productObj = ProductQuery::create()->findPk($product);
if (null === $category) {
$category = $productCategories;
} else {
$category = array_merge($category, $productCategories);
}
}
// Ignore if the product cannot be found.
if ($productObj !== null)
$template = $productObj->getTemplate();
}
if (null !== $category) {
$search->filterByCategory(
CategoryQuery::create()->filterById($category)->find(),
// If we have to filter by template, find all attributes assigned to this template, and filter by found IDs
if (null !== $template) {
$search->filterById(
AttributeTemplateQuery::create()->filterByTemplateId($template)->select('id')->find(),
Criteria::IN
);
}

View File

@@ -0,0 +1,114 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
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\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\Base\CategoryQuery;
use Thelia\Model\Base\ProductCategoryQuery;
use Thelia\Model\Base\TemplateQuery;
use Thelia\Model\Map\ProductCategoryTableMap;
use Thelia\Type\TypeCollection;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
/**
*
* Template loop
*
*
* Class Template
* @package Thelia\Core\Template\Loop
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class Template extends BaseI18nLoop
{
public $timestampable = true;
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createIntListTypeArgument('exclude')
);
}
/**
* @param $pagination
*
* @return \Thelia\Core\Template\Element\LoopResult
*/
public function exec(&$pagination)
{
$search = TemplateQuery::create();
$backendContext = $this->getBackend_context();
$lang = $this->getLang();
/* manage translations */
$locale = $this->configureI18nProcessing($search, $columns = array('NAME'));
$id = $this->getId();
if (null !== $id) {
$search->filterById($id, Criteria::IN);
}
$exclude = $this->getExclude();
if (null !== $exclude) {
$search->filterById($exclude, Criteria::NOT_IN);
}
/* perform search */
$templates = $this->search($search, $pagination);
$loopResult = new LoopResult($templates);
foreach ($templates as $template) {
$loopResultRow = new LoopResultRow($loopResult, $template, $this->versionable, $this->timestampable, $this->countable);
$loopResultRow
->set("ID", $template->getId())
->set("IS_TRANSLATED" , $template->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE" , $locale)
->set("NAME" , $template->getVirtualColumn('i18n_NAME'))
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -145,7 +145,7 @@ class Form extends AbstractSmartyPlugin
public function renderFormField($params, $content, \Smarty_Internal_Template $template, &$repeat)
{
if ($repeat) {
if ($repeat) {
$formFieldView = $this->getFormFieldView($params);
@@ -153,25 +153,25 @@ class Form extends AbstractSmartyPlugin
$value = $formFieldView->vars["value"];
/* FIXME: doesnt work. We got "This form should not contain extra fields." error.
// We have a collection
if (is_array($value)) {
// We have a collection
if (is_array($value)) {
$key = $this->getParam($params, 'value_key');
$key = $this->getParam($params, 'value_key');
if ($key != null) {
if ($key != null) {
if (isset($value[$key])) {
if (isset($value[$key])) {
$name = sprintf("%s[%s]", $formFieldView->vars["full_name"], $key);
$val = $value[$key];
$name = sprintf("%s[%s]", $formFieldView->vars["full_name"], $key);
$val = $value[$key];
$this->assignFieldValues($template, $name, $val, $formFieldView->vars);
}
}
}
else {
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVars["value"], $formFieldView->vars);
}
$this->assignFieldValues($template, $name, $val, $formFieldView->vars);
}
}
}
else {
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVars["value"], $formFieldView->vars);
}
*/
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $formFieldView->vars["value"], $formFieldView->vars);

View File

@@ -212,7 +212,7 @@ class TheliaHttpKernel extends HttpKernel
if (Model\ConfigQuery::read("session_config.default")) {
$storage->setSaveHandler(new Session\Storage\Handler\NativeFileSessionHandler(Model\ConfigQuery::read("session_config.save_path", THELIA_ROOT . '/local/session/')));
} else {
$handlerString = Model\ConfigQuery::read("session_config.handlers");
$handlerString = Model\ConfigQuery::read("session_config.handlers", 'Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler');
$handler = new $handlerString;

View File

@@ -0,0 +1,57 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
class TemplateCreationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("name" , "text" , array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Template Name *"),
"label_attr" => array(
"for" => "name"
))
)
->add("locale" , "text" , array(
"constraints" => array(
new NotBlank()
))
)
;
}
public function getName()
{
return "thelia_template_creation";
}
}

View File

@@ -0,0 +1,67 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\GreaterThan;
class TemplateModificationForm extends TemplateCreationForm
{
use StandardDescriptionFieldsTrait;
protected function buildForm()
{
parent::buildForm();
$this->formBuilder
->add("id", "hidden", array(
"constraints" => array(
new GreaterThan(
array('value' => 0)
)
)
))
/*
->add('attributes', 'collection', array(
'type' => 'text',
'options' => array('required' => false)
))
*/
/* FIXME: doesn't work
->add('features', 'collection', array(
'type' => 'text',
'options' => array('required' => false)
))
*/
;
}
public function getName()
{
return "thelia_template_modification";
}
}

View File

@@ -6,6 +6,7 @@ use Thelia\Core\Security\User\UserInterface;
use Thelia\Core\Security\Role\Role;
use Thelia\Model\Base\Admin as BaseAdmin;
use Propel\Runtime\Connection\ConnectionInterface;
/**
* Skeleton subclass for representing a row from the 'admin' table.
@@ -20,6 +21,16 @@ use Thelia\Model\Base\Admin as BaseAdmin;
*/
class Admin extends BaseAdmin implements UserInterface
{
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
// Set the serial number (for auto-login)
$this->setRememberMeSerial(uniqid());
return true;
}
public function setPassword($password)
{
@@ -65,4 +76,32 @@ class Admin extends BaseAdmin implements UserInterface
public function getRoles() {
return array(new Role('ADMIN'));
}
/**
* {@inheritDoc}
*/
public function getToken() {
return $this->getRememberMeToken();
}
/**
* {@inheritDoc}
*/
public function setToken($token) {
$this->setRememberMeToken($token)->save();
}
/**
* {@inheritDoc}
*/
public function getSerial() {
return $this->getRememberMeSerial();
}
/**
* {@inheritDoc}
*/
public function setSerial($serial) {
$this->setRememberMeSerial($serial)->save();
}
}

View File

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

View File

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

View File

@@ -101,6 +101,18 @@ abstract class Admin implements ActiveRecordInterface
*/
protected $salt;
/**
* The value for the remember_me_token field.
* @var string
*/
protected $remember_me_token;
/**
* The value for the remember_me_serial field.
* @var string
*/
protected $remember_me_serial;
/**
* The value for the created_at field.
* @var string
@@ -475,6 +487,28 @@ abstract class Admin implements ActiveRecordInterface
return $this->salt;
}
/**
* Get the [remember_me_token] column value.
*
* @return string
*/
public function getRememberMeToken()
{
return $this->remember_me_token;
}
/**
* Get the [remember_me_serial] column value.
*
* @return string
*/
public function getRememberMeSerial()
{
return $this->remember_me_serial;
}
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -662,6 +696,48 @@ abstract class Admin implements ActiveRecordInterface
return $this;
} // setSalt()
/**
* Set the value of [remember_me_token] column.
*
* @param string $v new value
* @return \Thelia\Model\Admin The current object (for fluent API support)
*/
public function setRememberMeToken($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->remember_me_token !== $v) {
$this->remember_me_token = $v;
$this->modifiedColumns[] = AdminTableMap::REMEMBER_ME_TOKEN;
}
return $this;
} // setRememberMeToken()
/**
* Set the value of [remember_me_serial] column.
*
* @param string $v new value
* @return \Thelia\Model\Admin The current object (for fluent API support)
*/
public function setRememberMeSerial($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->remember_me_serial !== $v) {
$this->remember_me_serial = $v;
$this->modifiedColumns[] = AdminTableMap::REMEMBER_ME_SERIAL;
}
return $this;
} // setRememberMeSerial()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -762,13 +838,19 @@ abstract class Admin implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AdminTableMap::translateFieldName('Salt', TableMap::TYPE_PHPNAME, $indexType)];
$this->salt = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AdminTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
$this->remember_me_token = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
$this->remember_me_serial = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : AdminTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : AdminTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -781,7 +863,7 @@ abstract class Admin implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 9; // 9 = AdminTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 11; // 11 = AdminTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Admin object", 0, $e);
@@ -1069,6 +1151,12 @@ abstract class Admin implements ActiveRecordInterface
if ($this->isColumnModified(AdminTableMap::SALT)) {
$modifiedColumns[':p' . $index++] = 'SALT';
}
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_TOKEN)) {
$modifiedColumns[':p' . $index++] = 'REMEMBER_ME_TOKEN';
}
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_SERIAL)) {
$modifiedColumns[':p' . $index++] = 'REMEMBER_ME_SERIAL';
}
if ($this->isColumnModified(AdminTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1107,6 +1195,12 @@ abstract class Admin implements ActiveRecordInterface
case 'SALT':
$stmt->bindValue($identifier, $this->salt, PDO::PARAM_STR);
break;
case 'REMEMBER_ME_TOKEN':
$stmt->bindValue($identifier, $this->remember_me_token, PDO::PARAM_STR);
break;
case 'REMEMBER_ME_SERIAL':
$stmt->bindValue($identifier, $this->remember_me_serial, PDO::PARAM_STR);
break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1197,9 +1291,15 @@ abstract class Admin implements ActiveRecordInterface
return $this->getSalt();
break;
case 7:
return $this->getCreatedAt();
return $this->getRememberMeToken();
break;
case 8:
return $this->getRememberMeSerial();
break;
case 9:
return $this->getCreatedAt();
break;
case 10:
return $this->getUpdatedAt();
break;
default:
@@ -1238,8 +1338,10 @@ abstract class Admin implements ActiveRecordInterface
$keys[4] => $this->getPassword(),
$keys[5] => $this->getAlgo(),
$keys[6] => $this->getSalt(),
$keys[7] => $this->getCreatedAt(),
$keys[8] => $this->getUpdatedAt(),
$keys[7] => $this->getRememberMeToken(),
$keys[8] => $this->getRememberMeSerial(),
$keys[9] => $this->getCreatedAt(),
$keys[10] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1307,9 +1409,15 @@ abstract class Admin implements ActiveRecordInterface
$this->setSalt($value);
break;
case 7:
$this->setCreatedAt($value);
$this->setRememberMeToken($value);
break;
case 8:
$this->setRememberMeSerial($value);
break;
case 9:
$this->setCreatedAt($value);
break;
case 10:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1343,8 +1451,10 @@ abstract class Admin implements ActiveRecordInterface
if (array_key_exists($keys[4], $arr)) $this->setPassword($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setAlgo($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setSalt($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
if (array_key_exists($keys[7], $arr)) $this->setRememberMeToken($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setRememberMeSerial($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]);
}
/**
@@ -1363,6 +1473,8 @@ abstract class Admin implements ActiveRecordInterface
if ($this->isColumnModified(AdminTableMap::PASSWORD)) $criteria->add(AdminTableMap::PASSWORD, $this->password);
if ($this->isColumnModified(AdminTableMap::ALGO)) $criteria->add(AdminTableMap::ALGO, $this->algo);
if ($this->isColumnModified(AdminTableMap::SALT)) $criteria->add(AdminTableMap::SALT, $this->salt);
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_TOKEN)) $criteria->add(AdminTableMap::REMEMBER_ME_TOKEN, $this->remember_me_token);
if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_SERIAL)) $criteria->add(AdminTableMap::REMEMBER_ME_SERIAL, $this->remember_me_serial);
if ($this->isColumnModified(AdminTableMap::CREATED_AT)) $criteria->add(AdminTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(AdminTableMap::UPDATED_AT)) $criteria->add(AdminTableMap::UPDATED_AT, $this->updated_at);
@@ -1434,6 +1546,8 @@ abstract class Admin implements ActiveRecordInterface
$copyObj->setPassword($this->getPassword());
$copyObj->setAlgo($this->getAlgo());
$copyObj->setSalt($this->getSalt());
$copyObj->setRememberMeToken($this->getRememberMeToken());
$copyObj->setRememberMeSerial($this->getRememberMeSerial());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1935,6 +2049,8 @@ abstract class Admin implements ActiveRecordInterface
$this->password = null;
$this->algo = null;
$this->salt = null;
$this->remember_me_token = null;
$this->remember_me_serial = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;

View File

@@ -28,6 +28,8 @@ use Thelia\Model\Map\AdminTableMap;
* @method ChildAdminQuery orderByPassword($order = Criteria::ASC) Order by the password column
* @method ChildAdminQuery orderByAlgo($order = Criteria::ASC) Order by the algo column
* @method ChildAdminQuery orderBySalt($order = Criteria::ASC) Order by the salt column
* @method ChildAdminQuery orderByRememberMeToken($order = Criteria::ASC) Order by the remember_me_token column
* @method ChildAdminQuery orderByRememberMeSerial($order = Criteria::ASC) Order by the remember_me_serial column
* @method ChildAdminQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildAdminQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -38,6 +40,8 @@ use Thelia\Model\Map\AdminTableMap;
* @method ChildAdminQuery groupByPassword() Group by the password column
* @method ChildAdminQuery groupByAlgo() Group by the algo column
* @method ChildAdminQuery groupBySalt() Group by the salt column
* @method ChildAdminQuery groupByRememberMeToken() Group by the remember_me_token column
* @method ChildAdminQuery groupByRememberMeSerial() Group by the remember_me_serial column
* @method ChildAdminQuery groupByCreatedAt() Group by the created_at column
* @method ChildAdminQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -59,6 +63,8 @@ use Thelia\Model\Map\AdminTableMap;
* @method ChildAdmin findOneByPassword(string $password) Return the first ChildAdmin filtered by the password column
* @method ChildAdmin findOneByAlgo(string $algo) Return the first ChildAdmin filtered by the algo column
* @method ChildAdmin findOneBySalt(string $salt) Return the first ChildAdmin filtered by the salt column
* @method ChildAdmin findOneByRememberMeToken(string $remember_me_token) Return the first ChildAdmin filtered by the remember_me_token column
* @method ChildAdmin findOneByRememberMeSerial(string $remember_me_serial) Return the first ChildAdmin filtered by the remember_me_serial column
* @method ChildAdmin findOneByCreatedAt(string $created_at) Return the first ChildAdmin filtered by the created_at column
* @method ChildAdmin findOneByUpdatedAt(string $updated_at) Return the first ChildAdmin filtered by the updated_at column
*
@@ -69,6 +75,8 @@ use Thelia\Model\Map\AdminTableMap;
* @method array findByPassword(string $password) Return ChildAdmin objects filtered by the password column
* @method array findByAlgo(string $algo) Return ChildAdmin objects filtered by the algo column
* @method array findBySalt(string $salt) Return ChildAdmin objects filtered by the salt column
* @method array findByRememberMeToken(string $remember_me_token) Return ChildAdmin objects filtered by the remember_me_token column
* @method array findByRememberMeSerial(string $remember_me_serial) Return ChildAdmin objects filtered by the remember_me_serial column
* @method array findByCreatedAt(string $created_at) Return ChildAdmin objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildAdmin objects filtered by the updated_at column
*
@@ -159,7 +167,7 @@ abstract class AdminQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0';
$sql = 'SELECT ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -463,6 +471,64 @@ abstract class AdminQuery extends ModelCriteria
return $this->addUsingAlias(AdminTableMap::SALT, $salt, $comparison);
}
/**
* Filter the query on the remember_me_token column
*
* Example usage:
* <code>
* $query->filterByRememberMeToken('fooValue'); // WHERE remember_me_token = 'fooValue'
* $query->filterByRememberMeToken('%fooValue%'); // WHERE remember_me_token LIKE '%fooValue%'
* </code>
*
* @param string $rememberMeToken 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 ChildAdminQuery The current query, for fluid interface
*/
public function filterByRememberMeToken($rememberMeToken = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($rememberMeToken)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $rememberMeToken)) {
$rememberMeToken = str_replace('*', '%', $rememberMeToken);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminTableMap::REMEMBER_ME_TOKEN, $rememberMeToken, $comparison);
}
/**
* Filter the query on the remember_me_serial column
*
* Example usage:
* <code>
* $query->filterByRememberMeSerial('fooValue'); // WHERE remember_me_serial = 'fooValue'
* $query->filterByRememberMeSerial('%fooValue%'); // WHERE remember_me_serial LIKE '%fooValue%'
* </code>
*
* @param string $rememberMeSerial 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 ChildAdminQuery The current query, for fluid interface
*/
public function filterByRememberMeSerial($rememberMeSerial = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($rememberMeSerial)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $rememberMeSerial)) {
$rememberMeSerial = str_replace('*', '%', $rememberMeSerial);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AdminTableMap::REMEMBER_ME_SERIAL, $rememberMeSerial, $comparison);
}
/**
* Filter the query on the created_at column
*

View File

@@ -20,15 +20,15 @@ use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Attribute as ChildAttribute;
use Thelia\Model\AttributeAv as ChildAttributeAv;
use Thelia\Model\AttributeAvQuery as ChildAttributeAvQuery;
use Thelia\Model\AttributeCategory as ChildAttributeCategory;
use Thelia\Model\AttributeCategoryQuery as ChildAttributeCategoryQuery;
use Thelia\Model\AttributeCombination as ChildAttributeCombination;
use Thelia\Model\AttributeCombinationQuery as ChildAttributeCombinationQuery;
use Thelia\Model\AttributeI18n as ChildAttributeI18n;
use Thelia\Model\AttributeI18nQuery as ChildAttributeI18nQuery;
use Thelia\Model\AttributeQuery as ChildAttributeQuery;
use Thelia\Model\Category as ChildCategory;
use Thelia\Model\CategoryQuery as ChildCategoryQuery;
use Thelia\Model\AttributeTemplate as ChildAttributeTemplate;
use Thelia\Model\AttributeTemplateQuery as ChildAttributeTemplateQuery;
use Thelia\Model\Template as ChildTemplate;
use Thelia\Model\TemplateQuery as ChildTemplateQuery;
use Thelia\Model\Map\AttributeTableMap;
abstract class Attribute implements ActiveRecordInterface
@@ -102,10 +102,10 @@ abstract class Attribute implements ActiveRecordInterface
protected $collAttributeCombinationsPartial;
/**
* @var ObjectCollection|ChildAttributeCategory[] Collection to store aggregation of ChildAttributeCategory objects.
* @var ObjectCollection|ChildAttributeTemplate[] Collection to store aggregation of ChildAttributeTemplate objects.
*/
protected $collAttributeCategories;
protected $collAttributeCategoriesPartial;
protected $collAttributeTemplates;
protected $collAttributeTemplatesPartial;
/**
* @var ObjectCollection|ChildAttributeI18n[] Collection to store aggregation of ChildAttributeI18n objects.
@@ -114,9 +114,9 @@ abstract class Attribute implements ActiveRecordInterface
protected $collAttributeI18nsPartial;
/**
* @var ChildCategory[] Collection to store aggregation of ChildCategory objects.
* @var ChildTemplate[] Collection to store aggregation of ChildTemplate objects.
*/
protected $collCategories;
protected $collTemplates;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -144,7 +144,7 @@ abstract class Attribute implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $categoriesScheduledForDeletion = null;
protected $templatesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
@@ -162,7 +162,7 @@ abstract class Attribute implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $attributeCategoriesScheduledForDeletion = null;
protected $attributeTemplatesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
@@ -697,11 +697,11 @@ abstract class Attribute implements ActiveRecordInterface
$this->collAttributeCombinations = null;
$this->collAttributeCategories = null;
$this->collAttributeTemplates = null;
$this->collAttributeI18ns = null;
$this->collCategories = null;
$this->collTemplates = null;
} // if (deep)
}
@@ -835,29 +835,29 @@ abstract class Attribute implements ActiveRecordInterface
$this->resetModified();
}
if ($this->categoriesScheduledForDeletion !== null) {
if (!$this->categoriesScheduledForDeletion->isEmpty()) {
if ($this->templatesScheduledForDeletion !== null) {
if (!$this->templatesScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->categoriesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($remotePk, $pk);
foreach ($this->templatesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($pk, $remotePk);
}
AttributeCategoryQuery::create()
AttributeTemplateQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->categoriesScheduledForDeletion = null;
$this->templatesScheduledForDeletion = null;
}
foreach ($this->getCategories() as $category) {
if ($category->isModified()) {
$category->save($con);
foreach ($this->getTemplates() as $template) {
if ($template->isModified()) {
$template->save($con);
}
}
} elseif ($this->collCategories) {
foreach ($this->collCategories as $category) {
if ($category->isModified()) {
$category->save($con);
} elseif ($this->collTemplates) {
foreach ($this->collTemplates as $template) {
if ($template->isModified()) {
$template->save($con);
}
}
}
@@ -896,17 +896,17 @@ abstract class Attribute implements ActiveRecordInterface
}
}
if ($this->attributeCategoriesScheduledForDeletion !== null) {
if (!$this->attributeCategoriesScheduledForDeletion->isEmpty()) {
\Thelia\Model\AttributeCategoryQuery::create()
->filterByPrimaryKeys($this->attributeCategoriesScheduledForDeletion->getPrimaryKeys(false))
if ($this->attributeTemplatesScheduledForDeletion !== null) {
if (!$this->attributeTemplatesScheduledForDeletion->isEmpty()) {
\Thelia\Model\AttributeTemplateQuery::create()
->filterByPrimaryKeys($this->attributeTemplatesScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->attributeCategoriesScheduledForDeletion = null;
$this->attributeTemplatesScheduledForDeletion = null;
}
}
if ($this->collAttributeCategories !== null) {
foreach ($this->collAttributeCategories as $referrerFK) {
if ($this->collAttributeTemplates !== null) {
foreach ($this->collAttributeTemplates as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
@@ -1112,8 +1112,8 @@ abstract class Attribute implements ActiveRecordInterface
if (null !== $this->collAttributeCombinations) {
$result['AttributeCombinations'] = $this->collAttributeCombinations->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collAttributeCategories) {
$result['AttributeCategories'] = $this->collAttributeCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
if (null !== $this->collAttributeTemplates) {
$result['AttributeTemplates'] = $this->collAttributeTemplates->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collAttributeI18ns) {
$result['AttributeI18ns'] = $this->collAttributeI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
@@ -1291,9 +1291,9 @@ abstract class Attribute implements ActiveRecordInterface
}
}
foreach ($this->getAttributeCategories() as $relObj) {
foreach ($this->getAttributeTemplates() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addAttributeCategory($relObj->copy($deepCopy));
$copyObj->addAttributeTemplate($relObj->copy($deepCopy));
}
}
@@ -1350,8 +1350,8 @@ abstract class Attribute implements ActiveRecordInterface
if ('AttributeCombination' == $relationName) {
return $this->initAttributeCombinations();
}
if ('AttributeCategory' == $relationName) {
return $this->initAttributeCategories();
if ('AttributeTemplate' == $relationName) {
return $this->initAttributeTemplates();
}
if ('AttributeI18n' == $relationName) {
return $this->initAttributeI18ns();
@@ -1848,31 +1848,31 @@ abstract class Attribute implements ActiveRecordInterface
}
/**
* Clears out the collAttributeCategories collection
* Clears out the collAttributeTemplates collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @see addAttributeCategories()
* @see addAttributeTemplates()
*/
public function clearAttributeCategories()
public function clearAttributeTemplates()
{
$this->collAttributeCategories = null; // important to set this to NULL since that means it is uninitialized
$this->collAttributeTemplates = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collAttributeCategories collection loaded partially.
* Reset is the collAttributeTemplates collection loaded partially.
*/
public function resetPartialAttributeCategories($v = true)
public function resetPartialAttributeTemplates($v = true)
{
$this->collAttributeCategoriesPartial = $v;
$this->collAttributeTemplatesPartial = $v;
}
/**
* Initializes the collAttributeCategories collection.
* Initializes the collAttributeTemplates collection.
*
* By default this just sets the collAttributeCategories collection to an empty array (like clearcollAttributeCategories());
* By default this just sets the collAttributeTemplates collection to an empty array (like clearcollAttributeTemplates());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
@@ -1881,17 +1881,17 @@ abstract class Attribute implements ActiveRecordInterface
*
* @return void
*/
public function initAttributeCategories($overrideExisting = true)
public function initAttributeTemplates($overrideExisting = true)
{
if (null !== $this->collAttributeCategories && !$overrideExisting) {
if (null !== $this->collAttributeTemplates && !$overrideExisting) {
return;
}
$this->collAttributeCategories = new ObjectCollection();
$this->collAttributeCategories->setModel('\Thelia\Model\AttributeCategory');
$this->collAttributeTemplates = new ObjectCollection();
$this->collAttributeTemplates->setModel('\Thelia\Model\AttributeTemplate');
}
/**
* Gets an array of ChildAttributeCategory objects which contain a foreign key that references this object.
* Gets an array of ChildAttributeTemplate objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -1901,109 +1901,109 @@ abstract class Attribute implements ActiveRecordInterface
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @return Collection|ChildAttributeCategory[] List of ChildAttributeCategory objects
* @return Collection|ChildAttributeTemplate[] List of ChildAttributeTemplate objects
* @throws PropelException
*/
public function getAttributeCategories($criteria = null, ConnectionInterface $con = null)
public function getAttributeTemplates($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collAttributeCategoriesPartial && !$this->isNew();
if (null === $this->collAttributeCategories || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collAttributeCategories) {
$partial = $this->collAttributeTemplatesPartial && !$this->isNew();
if (null === $this->collAttributeTemplates || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collAttributeTemplates) {
// return empty collection
$this->initAttributeCategories();
$this->initAttributeTemplates();
} else {
$collAttributeCategories = ChildAttributeCategoryQuery::create(null, $criteria)
$collAttributeTemplates = ChildAttributeTemplateQuery::create(null, $criteria)
->filterByAttribute($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collAttributeCategoriesPartial && count($collAttributeCategories)) {
$this->initAttributeCategories(false);
if (false !== $this->collAttributeTemplatesPartial && count($collAttributeTemplates)) {
$this->initAttributeTemplates(false);
foreach ($collAttributeCategories as $obj) {
if (false == $this->collAttributeCategories->contains($obj)) {
$this->collAttributeCategories->append($obj);
foreach ($collAttributeTemplates as $obj) {
if (false == $this->collAttributeTemplates->contains($obj)) {
$this->collAttributeTemplates->append($obj);
}
}
$this->collAttributeCategoriesPartial = true;
$this->collAttributeTemplatesPartial = true;
}
$collAttributeCategories->getInternalIterator()->rewind();
$collAttributeTemplates->getInternalIterator()->rewind();
return $collAttributeCategories;
return $collAttributeTemplates;
}
if ($partial && $this->collAttributeCategories) {
foreach ($this->collAttributeCategories as $obj) {
if ($partial && $this->collAttributeTemplates) {
foreach ($this->collAttributeTemplates as $obj) {
if ($obj->isNew()) {
$collAttributeCategories[] = $obj;
$collAttributeTemplates[] = $obj;
}
}
}
$this->collAttributeCategories = $collAttributeCategories;
$this->collAttributeCategoriesPartial = false;
$this->collAttributeTemplates = $collAttributeTemplates;
$this->collAttributeTemplatesPartial = false;
}
}
return $this->collAttributeCategories;
return $this->collAttributeTemplates;
}
/**
* Sets a collection of AttributeCategory objects related by a one-to-many relationship
* Sets a collection of AttributeTemplate objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
* @param Collection $attributeCategories A Propel collection.
* @param Collection $attributeTemplates A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildAttribute The current object (for fluent API support)
*/
public function setAttributeCategories(Collection $attributeCategories, ConnectionInterface $con = null)
public function setAttributeTemplates(Collection $attributeTemplates, ConnectionInterface $con = null)
{
$attributeCategoriesToDelete = $this->getAttributeCategories(new Criteria(), $con)->diff($attributeCategories);
$attributeTemplatesToDelete = $this->getAttributeTemplates(new Criteria(), $con)->diff($attributeTemplates);
$this->attributeCategoriesScheduledForDeletion = $attributeCategoriesToDelete;
$this->attributeTemplatesScheduledForDeletion = $attributeTemplatesToDelete;
foreach ($attributeCategoriesToDelete as $attributeCategoryRemoved) {
$attributeCategoryRemoved->setAttribute(null);
foreach ($attributeTemplatesToDelete as $attributeTemplateRemoved) {
$attributeTemplateRemoved->setAttribute(null);
}
$this->collAttributeCategories = null;
foreach ($attributeCategories as $attributeCategory) {
$this->addAttributeCategory($attributeCategory);
$this->collAttributeTemplates = null;
foreach ($attributeTemplates as $attributeTemplate) {
$this->addAttributeTemplate($attributeTemplate);
}
$this->collAttributeCategories = $attributeCategories;
$this->collAttributeCategoriesPartial = false;
$this->collAttributeTemplates = $attributeTemplates;
$this->collAttributeTemplatesPartial = false;
return $this;
}
/**
* Returns the number of related AttributeCategory objects.
* Returns the number of related AttributeTemplate objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related AttributeCategory objects.
* @return int Count of related AttributeTemplate objects.
* @throws PropelException
*/
public function countAttributeCategories(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
public function countAttributeTemplates(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collAttributeCategoriesPartial && !$this->isNew();
if (null === $this->collAttributeCategories || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collAttributeCategories) {
$partial = $this->collAttributeTemplatesPartial && !$this->isNew();
if (null === $this->collAttributeTemplates || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collAttributeTemplates) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getAttributeCategories());
return count($this->getAttributeTemplates());
}
$query = ChildAttributeCategoryQuery::create(null, $criteria);
$query = ChildAttributeTemplateQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -2013,53 +2013,53 @@ abstract class Attribute implements ActiveRecordInterface
->count($con);
}
return count($this->collAttributeCategories);
return count($this->collAttributeTemplates);
}
/**
* Method called to associate a ChildAttributeCategory object to this object
* through the ChildAttributeCategory foreign key attribute.
* Method called to associate a ChildAttributeTemplate object to this object
* through the ChildAttributeTemplate foreign key attribute.
*
* @param ChildAttributeCategory $l ChildAttributeCategory
* @param ChildAttributeTemplate $l ChildAttributeTemplate
* @return \Thelia\Model\Attribute The current object (for fluent API support)
*/
public function addAttributeCategory(ChildAttributeCategory $l)
public function addAttributeTemplate(ChildAttributeTemplate $l)
{
if ($this->collAttributeCategories === null) {
$this->initAttributeCategories();
$this->collAttributeCategoriesPartial = true;
if ($this->collAttributeTemplates === null) {
$this->initAttributeTemplates();
$this->collAttributeTemplatesPartial = true;
}
if (!in_array($l, $this->collAttributeCategories->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddAttributeCategory($l);
if (!in_array($l, $this->collAttributeTemplates->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddAttributeTemplate($l);
}
return $this;
}
/**
* @param AttributeCategory $attributeCategory The attributeCategory object to add.
* @param AttributeTemplate $attributeTemplate The attributeTemplate object to add.
*/
protected function doAddAttributeCategory($attributeCategory)
protected function doAddAttributeTemplate($attributeTemplate)
{
$this->collAttributeCategories[]= $attributeCategory;
$attributeCategory->setAttribute($this);
$this->collAttributeTemplates[]= $attributeTemplate;
$attributeTemplate->setAttribute($this);
}
/**
* @param AttributeCategory $attributeCategory The attributeCategory object to remove.
* @param AttributeTemplate $attributeTemplate The attributeTemplate object to remove.
* @return ChildAttribute The current object (for fluent API support)
*/
public function removeAttributeCategory($attributeCategory)
public function removeAttributeTemplate($attributeTemplate)
{
if ($this->getAttributeCategories()->contains($attributeCategory)) {
$this->collAttributeCategories->remove($this->collAttributeCategories->search($attributeCategory));
if (null === $this->attributeCategoriesScheduledForDeletion) {
$this->attributeCategoriesScheduledForDeletion = clone $this->collAttributeCategories;
$this->attributeCategoriesScheduledForDeletion->clear();
if ($this->getAttributeTemplates()->contains($attributeTemplate)) {
$this->collAttributeTemplates->remove($this->collAttributeTemplates->search($attributeTemplate));
if (null === $this->attributeTemplatesScheduledForDeletion) {
$this->attributeTemplatesScheduledForDeletion = clone $this->collAttributeTemplates;
$this->attributeTemplatesScheduledForDeletion->clear();
}
$this->attributeCategoriesScheduledForDeletion[]= clone $attributeCategory;
$attributeCategory->setAttribute(null);
$this->attributeTemplatesScheduledForDeletion[]= clone $attributeTemplate;
$attributeTemplate->setAttribute(null);
}
return $this;
@@ -2071,7 +2071,7 @@ abstract class Attribute implements ActiveRecordInterface
* an identical criteria, it returns the collection.
* Otherwise if this Attribute is new, it will return
* an empty collection; or if this Attribute has previously
* been saved, it will retrieve related AttributeCategories from storage.
* been saved, it will retrieve related AttributeTemplates from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
@@ -2080,14 +2080,14 @@ abstract class Attribute implements ActiveRecordInterface
* @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|ChildAttributeCategory[] List of ChildAttributeCategory objects
* @return Collection|ChildAttributeTemplate[] List of ChildAttributeTemplate objects
*/
public function getAttributeCategoriesJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
public function getAttributeTemplatesJoinTemplate($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildAttributeCategoryQuery::create(null, $criteria);
$query->joinWith('Category', $joinBehavior);
$query = ChildAttributeTemplateQuery::create(null, $criteria);
$query->joinWith('Template', $joinBehavior);
return $this->getAttributeCategories($query, $con);
return $this->getAttributeTemplates($query, $con);
}
/**
@@ -2316,38 +2316,38 @@ abstract class Attribute implements ActiveRecordInterface
}
/**
* Clears out the collCategories collection
* Clears out the collTemplates collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @see addCategories()
* @see addTemplates()
*/
public function clearCategories()
public function clearTemplates()
{
$this->collCategories = null; // important to set this to NULL since that means it is uninitialized
$this->collCategoriesPartial = null;
$this->collTemplates = null; // important to set this to NULL since that means it is uninitialized
$this->collTemplatesPartial = null;
}
/**
* Initializes the collCategories collection.
* Initializes the collTemplates collection.
*
* By default this just sets the collCategories collection to an empty collection (like clearCategories());
* By default this just sets the collTemplates collection to an empty collection (like clearTemplates());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
* @return void
*/
public function initCategories()
public function initTemplates()
{
$this->collCategories = new ObjectCollection();
$this->collCategories->setModel('\Thelia\Model\Category');
$this->collTemplates = new ObjectCollection();
$this->collTemplates->setModel('\Thelia\Model\Template');
}
/**
* Gets a collection of ChildCategory objects related by a many-to-many relationship
* to the current object by way of the attribute_category cross-reference table.
* Gets a collection of ChildTemplate objects related by a many-to-many relationship
* to the current object by way of the attribute_template cross-reference table.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -2358,73 +2358,73 @@ abstract class Attribute implements ActiveRecordInterface
* @param Criteria $criteria Optional query object to filter the query
* @param ConnectionInterface $con Optional connection object
*
* @return ObjectCollection|ChildCategory[] List of ChildCategory objects
* @return ObjectCollection|ChildTemplate[] List of ChildTemplate objects
*/
public function getCategories($criteria = null, ConnectionInterface $con = null)
public function getTemplates($criteria = null, ConnectionInterface $con = null)
{
if (null === $this->collCategories || null !== $criteria) {
if ($this->isNew() && null === $this->collCategories) {
if (null === $this->collTemplates || null !== $criteria) {
if ($this->isNew() && null === $this->collTemplates) {
// return empty collection
$this->initCategories();
$this->initTemplates();
} else {
$collCategories = ChildCategoryQuery::create(null, $criteria)
$collTemplates = ChildTemplateQuery::create(null, $criteria)
->filterByAttribute($this)
->find($con);
if (null !== $criteria) {
return $collCategories;
return $collTemplates;
}
$this->collCategories = $collCategories;
$this->collTemplates = $collTemplates;
}
}
return $this->collCategories;
return $this->collTemplates;
}
/**
* Sets a collection of Category objects related by a many-to-many relationship
* to the current object by way of the attribute_category cross-reference table.
* Sets a collection of Template objects related by a many-to-many relationship
* to the current object by way of the attribute_template cross-reference table.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
* @param Collection $categories A Propel collection.
* @param Collection $templates A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildAttribute The current object (for fluent API support)
*/
public function setCategories(Collection $categories, ConnectionInterface $con = null)
public function setTemplates(Collection $templates, ConnectionInterface $con = null)
{
$this->clearCategories();
$currentCategories = $this->getCategories();
$this->clearTemplates();
$currentTemplates = $this->getTemplates();
$this->categoriesScheduledForDeletion = $currentCategories->diff($categories);
$this->templatesScheduledForDeletion = $currentTemplates->diff($templates);
foreach ($categories as $category) {
if (!$currentCategories->contains($category)) {
$this->doAddCategory($category);
foreach ($templates as $template) {
if (!$currentTemplates->contains($template)) {
$this->doAddTemplate($template);
}
}
$this->collCategories = $categories;
$this->collTemplates = $templates;
return $this;
}
/**
* Gets the number of ChildCategory objects related by a many-to-many relationship
* to the current object by way of the attribute_category cross-reference table.
* Gets the number of ChildTemplate objects related by a many-to-many relationship
* to the current object by way of the attribute_template cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param ConnectionInterface $con Optional connection object
*
* @return int the number of related ChildCategory objects
* @return int the number of related ChildTemplate objects
*/
public function countCategories($criteria = null, $distinct = false, ConnectionInterface $con = null)
public function countTemplates($criteria = null, $distinct = false, ConnectionInterface $con = null)
{
if (null === $this->collCategories || null !== $criteria) {
if ($this->isNew() && null === $this->collCategories) {
if (null === $this->collTemplates || null !== $criteria) {
if ($this->isNew() && null === $this->collTemplates) {
return 0;
} else {
$query = ChildCategoryQuery::create(null, $criteria);
$query = ChildTemplateQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -2434,65 +2434,65 @@ abstract class Attribute implements ActiveRecordInterface
->count($con);
}
} else {
return count($this->collCategories);
return count($this->collTemplates);
}
}
/**
* Associate a ChildCategory object to this object
* through the attribute_category cross reference table.
* Associate a ChildTemplate object to this object
* through the attribute_template cross reference table.
*
* @param ChildCategory $category The ChildAttributeCategory object to relate
* @param ChildTemplate $template The ChildAttributeTemplate object to relate
* @return ChildAttribute The current object (for fluent API support)
*/
public function addCategory(ChildCategory $category)
public function addTemplate(ChildTemplate $template)
{
if ($this->collCategories === null) {
$this->initCategories();
if ($this->collTemplates === null) {
$this->initTemplates();
}
if (!$this->collCategories->contains($category)) { // only add it if the **same** object is not already associated
$this->doAddCategory($category);
$this->collCategories[] = $category;
if (!$this->collTemplates->contains($template)) { // only add it if the **same** object is not already associated
$this->doAddTemplate($template);
$this->collTemplates[] = $template;
}
return $this;
}
/**
* @param Category $category The category object to add.
* @param Template $template The template object to add.
*/
protected function doAddCategory($category)
protected function doAddTemplate($template)
{
$attributeCategory = new ChildAttributeCategory();
$attributeCategory->setCategory($category);
$this->addAttributeCategory($attributeCategory);
$attributeTemplate = new ChildAttributeTemplate();
$attributeTemplate->setTemplate($template);
$this->addAttributeTemplate($attributeTemplate);
// set the back reference to this object directly as using provided method either results
// in endless loop or in multiple relations
if (!$category->getAttributes()->contains($this)) {
$foreignCollection = $category->getAttributes();
if (!$template->getAttributes()->contains($this)) {
$foreignCollection = $template->getAttributes();
$foreignCollection[] = $this;
}
}
/**
* Remove a ChildCategory object to this object
* through the attribute_category cross reference table.
* Remove a ChildTemplate object to this object
* through the attribute_template cross reference table.
*
* @param ChildCategory $category The ChildAttributeCategory object to relate
* @param ChildTemplate $template The ChildAttributeTemplate object to relate
* @return ChildAttribute The current object (for fluent API support)
*/
public function removeCategory(ChildCategory $category)
public function removeTemplate(ChildTemplate $template)
{
if ($this->getCategories()->contains($category)) {
$this->collCategories->remove($this->collCategories->search($category));
if ($this->getTemplates()->contains($template)) {
$this->collTemplates->remove($this->collTemplates->search($template));
if (null === $this->categoriesScheduledForDeletion) {
$this->categoriesScheduledForDeletion = clone $this->collCategories;
$this->categoriesScheduledForDeletion->clear();
if (null === $this->templatesScheduledForDeletion) {
$this->templatesScheduledForDeletion = clone $this->collTemplates;
$this->templatesScheduledForDeletion->clear();
}
$this->categoriesScheduledForDeletion[] = $category;
$this->templatesScheduledForDeletion[] = $template;
}
return $this;
@@ -2536,8 +2536,8 @@ abstract class Attribute implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collAttributeCategories) {
foreach ($this->collAttributeCategories as $o) {
if ($this->collAttributeTemplates) {
foreach ($this->collAttributeTemplates as $o) {
$o->clearAllReferences($deep);
}
}
@@ -2546,8 +2546,8 @@ abstract class Attribute implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collCategories) {
foreach ($this->collCategories as $o) {
if ($this->collTemplates) {
foreach ($this->collTemplates as $o) {
$o->clearAllReferences($deep);
}
}
@@ -2565,18 +2565,18 @@ abstract class Attribute implements ActiveRecordInterface
$this->collAttributeCombinations->clearIterator();
}
$this->collAttributeCombinations = null;
if ($this->collAttributeCategories instanceof Collection) {
$this->collAttributeCategories->clearIterator();
if ($this->collAttributeTemplates instanceof Collection) {
$this->collAttributeTemplates->clearIterator();
}
$this->collAttributeCategories = null;
$this->collAttributeTemplates = null;
if ($this->collAttributeI18ns instanceof Collection) {
$this->collAttributeI18ns->clearIterator();
}
$this->collAttributeI18ns = null;
if ($this->collCategories instanceof Collection) {
$this->collCategories->clearIterator();
if ($this->collTemplates instanceof Collection) {
$this->collTemplates->clearIterator();
}
$this->collCategories = null;
$this->collTemplates = null;
}
/**

View File

@@ -44,9 +44,9 @@ use Thelia\Model\Map\AttributeTableMap;
* @method ChildAttributeQuery rightJoinAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCombination relation
* @method ChildAttributeQuery innerJoinAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCombination relation
*
* @method ChildAttributeQuery leftJoinAttributeCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCategory relation
* @method ChildAttributeQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation
* @method ChildAttributeQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation
* @method ChildAttributeQuery leftJoinAttributeTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeTemplate relation
* @method ChildAttributeQuery rightJoinAttributeTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeTemplate relation
* @method ChildAttributeQuery innerJoinAttributeTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeTemplate relation
*
* @method ChildAttributeQuery leftJoinAttributeI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeI18n relation
* @method ChildAttributeQuery rightJoinAttributeI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeI18n relation
@@ -556,40 +556,40 @@ abstract class AttributeQuery extends ModelCriteria
}
/**
* Filter the query by a related \Thelia\Model\AttributeCategory object
* Filter the query by a related \Thelia\Model\AttributeTemplate object
*
* @param \Thelia\Model\AttributeCategory|ObjectCollection $attributeCategory the related object to use as filter
* @param \Thelia\Model\AttributeTemplate|ObjectCollection $attributeTemplate the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAttributeQuery The current query, for fluid interface
*/
public function filterByAttributeCategory($attributeCategory, $comparison = null)
public function filterByAttributeTemplate($attributeTemplate, $comparison = null)
{
if ($attributeCategory instanceof \Thelia\Model\AttributeCategory) {
if ($attributeTemplate instanceof \Thelia\Model\AttributeTemplate) {
return $this
->addUsingAlias(AttributeTableMap::ID, $attributeCategory->getAttributeId(), $comparison);
} elseif ($attributeCategory instanceof ObjectCollection) {
->addUsingAlias(AttributeTableMap::ID, $attributeTemplate->getAttributeId(), $comparison);
} elseif ($attributeTemplate instanceof ObjectCollection) {
return $this
->useAttributeCategoryQuery()
->filterByPrimaryKeys($attributeCategory->getPrimaryKeys())
->useAttributeTemplateQuery()
->filterByPrimaryKeys($attributeTemplate->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAttributeCategory() only accepts arguments of type \Thelia\Model\AttributeCategory or Collection');
throw new PropelException('filterByAttributeTemplate() only accepts arguments of type \Thelia\Model\AttributeTemplate or Collection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeCategory relation
* Adds a JOIN clause to the query using the AttributeTemplate relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAttributeQuery The current query, for fluid interface
*/
public function joinAttributeCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function joinAttributeTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeCategory');
$relationMap = $tableMap->getRelation('AttributeTemplate');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -604,14 +604,14 @@ abstract class AttributeQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'AttributeCategory');
$this->addJoinObject($join, 'AttributeTemplate');
}
return $this;
}
/**
* Use the AttributeCategory relation AttributeCategory object
* Use the AttributeTemplate relation AttributeTemplate object
*
* @see useQuery()
*
@@ -619,13 +619,13 @@ abstract class AttributeQuery extends ModelCriteria
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\AttributeCategoryQuery A secondary query class using the current class as primary query
* @return \Thelia\Model\AttributeTemplateQuery A secondary query class using the current class as primary query
*/
public function useAttributeCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function useAttributeTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
->joinAttributeTemplate($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeTemplate', '\Thelia\Model\AttributeTemplateQuery');
}
/**
@@ -702,19 +702,19 @@ abstract class AttributeQuery extends ModelCriteria
}
/**
* Filter the query by a related Category object
* using the attribute_category table as cross reference
* Filter the query by a related Template object
* using the attribute_template table as cross reference
*
* @param Category $category the related object to use as filter
* @param Template $template the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAttributeQuery The current query, for fluid interface
*/
public function filterByCategory($category, $comparison = Criteria::EQUAL)
public function filterByTemplate($template, $comparison = Criteria::EQUAL)
{
return $this
->useAttributeCategoryQuery()
->filterByCategory($category, $comparison)
->useAttributeTemplateQuery()
->filterByTemplate($template, $comparison)
->endUse();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,759 @@
<?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\AttributeTemplate as ChildAttributeTemplate;
use Thelia\Model\AttributeTemplateQuery as ChildAttributeTemplateQuery;
use Thelia\Model\Map\AttributeTemplateTableMap;
/**
* Base class that represents a query for the 'attribute_template' table.
*
*
*
* @method ChildAttributeTemplateQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildAttributeTemplateQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column
* @method ChildAttributeTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
* @method ChildAttributeTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildAttributeTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildAttributeTemplateQuery groupById() Group by the id column
* @method ChildAttributeTemplateQuery groupByAttributeId() Group by the attribute_id column
* @method ChildAttributeTemplateQuery groupByTemplateId() Group by the template_id column
* @method ChildAttributeTemplateQuery groupByCreatedAt() Group by the created_at column
* @method ChildAttributeTemplateQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildAttributeTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildAttributeTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildAttributeTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildAttributeTemplateQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
* @method ChildAttributeTemplateQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
* @method ChildAttributeTemplateQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
*
* @method ChildAttributeTemplateQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
* @method ChildAttributeTemplateQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
* @method ChildAttributeTemplateQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
*
* @method ChildAttributeTemplate findOne(ConnectionInterface $con = null) Return the first ChildAttributeTemplate matching the query
* @method ChildAttributeTemplate findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAttributeTemplate matching the query, or a new ChildAttributeTemplate object populated from the query conditions when no match is found
*
* @method ChildAttributeTemplate findOneById(int $id) Return the first ChildAttributeTemplate filtered by the id column
* @method ChildAttributeTemplate findOneByAttributeId(int $attribute_id) Return the first ChildAttributeTemplate filtered by the attribute_id column
* @method ChildAttributeTemplate findOneByTemplateId(int $template_id) Return the first ChildAttributeTemplate filtered by the template_id column
* @method ChildAttributeTemplate findOneByCreatedAt(string $created_at) Return the first ChildAttributeTemplate filtered by the created_at column
* @method ChildAttributeTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildAttributeTemplate filtered by the updated_at column
*
* @method array findById(int $id) Return ChildAttributeTemplate objects filtered by the id column
* @method array findByAttributeId(int $attribute_id) Return ChildAttributeTemplate objects filtered by the attribute_id column
* @method array findByTemplateId(int $template_id) Return ChildAttributeTemplate objects filtered by the template_id column
* @method array findByCreatedAt(string $created_at) Return ChildAttributeTemplate objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildAttributeTemplate objects filtered by the updated_at column
*
*/
abstract class AttributeTemplateQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\AttributeTemplateQuery 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\\AttributeTemplate', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildAttributeTemplateQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildAttributeTemplateQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\AttributeTemplateQuery) {
return $criteria;
}
$query = new \Thelia\Model\AttributeTemplateQuery();
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 ChildAttributeTemplate|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = AttributeTemplateTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(AttributeTemplateTableMap::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 ChildAttributeTemplate A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, ATTRIBUTE_ID, TEMPLATE_ID, CREATED_AT, UPDATED_AT FROM attribute_template 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 ChildAttributeTemplate();
$obj->hydrate($row);
AttributeTemplateTableMap::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 ChildAttributeTemplate|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 ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(AttributeTemplateTableMap::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 ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(AttributeTemplateTableMap::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 ChildAttributeTemplateQuery 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(AttributeTemplateTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(AttributeTemplateTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeTemplateTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the attribute_id column
*
* Example usage:
* <code>
* $query->filterByAttributeId(1234); // WHERE attribute_id = 1234
* $query->filterByAttributeId(array(12, 34)); // WHERE attribute_id IN (12, 34)
* $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
* </code>
*
* @see filterByAttribute()
*
* @param mixed $attributeId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function filterByAttributeId($attributeId = null, $comparison = null)
{
if (is_array($attributeId)) {
$useMinMax = false;
if (isset($attributeId['min'])) {
$this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attributeId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($attributeId['max'])) {
$this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attributeId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attributeId, $comparison);
}
/**
* Filter the query on the template_id column
*
* Example usage:
* <code>
* $query->filterByTemplateId(1234); // WHERE template_id = 1234
* $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
* $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
* </code>
*
* @see filterByTemplate()
*
* @param mixed $templateId 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 ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function filterByTemplateId($templateId = null, $comparison = null)
{
if (is_array($templateId)) {
$useMinMax = false;
if (isset($templateId['min'])) {
$this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($templateId['max'])) {
$this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId, $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 ChildAttributeTemplateQuery 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(AttributeTemplateTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(AttributeTemplateTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeTemplateTableMap::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 ChildAttributeTemplateQuery 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(AttributeTemplateTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(AttributeTemplateTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeTemplateTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Attribute object
*
* @param \Thelia\Model\Attribute|ObjectCollection $attribute The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function filterByAttribute($attribute, $comparison = null)
{
if ($attribute instanceof \Thelia\Model\Attribute) {
return $this
->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attribute->getId(), $comparison);
} elseif ($attribute instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAttribute() only accepts arguments of type \Thelia\Model\Attribute or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Attribute relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Attribute');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Attribute');
}
return $this;
}
/**
* Use the Attribute relation Attribute object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\AttributeQuery A secondary query class using the current class as primary query
*/
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttribute($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
}
/**
* Filter the query by a related \Thelia\Model\Template object
*
* @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function filterByTemplate($template, $comparison = null)
{
if ($template instanceof \Thelia\Model\Template) {
return $this
->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $template->getId(), $comparison);
} elseif ($template instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Template relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Template');
// 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, 'Template');
}
return $this;
}
/**
* Use the Template relation Template 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\TemplateQuery A secondary query class using the current class as primary query
*/
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinTemplate($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
}
/**
* Exclude object from result
*
* @param ChildAttributeTemplate $attributeTemplate Object to remove from the list of results
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function prune($attributeTemplate = null)
{
if ($attributeTemplate) {
$this->addUsingAlias(AttributeTemplateTableMap::ID, $attributeTemplate->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the attribute_template 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(AttributeTemplateTableMap::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).
AttributeTemplateTableMap::clearInstancePool();
AttributeTemplateTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildAttributeTemplate or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildAttributeTemplate 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(AttributeTemplateTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(AttributeTemplateTableMap::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();
AttributeTemplateTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
AttributeTemplateTableMap::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 ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(AttributeTemplateTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(AttributeTemplateTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(AttributeTemplateTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(AttributeTemplateTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(AttributeTemplateTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(AttributeTemplateTableMap::CREATED_AT);
}
} // AttributeTemplateQuery

File diff suppressed because it is too large Load Diff

View File

@@ -50,14 +50,6 @@ use Thelia\Model\Map\CategoryTableMap;
* @method ChildCategoryQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation
* @method ChildCategoryQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
*
* @method ChildCategoryQuery leftJoinFeatureCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureCategory relation
* @method ChildCategoryQuery rightJoinFeatureCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureCategory relation
* @method ChildCategoryQuery innerJoinFeatureCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureCategory relation
*
* @method ChildCategoryQuery leftJoinAttributeCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCategory relation
* @method ChildCategoryQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation
* @method ChildCategoryQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation
*
* @method ChildCategoryQuery leftJoinCategoryImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryImage relation
* @method ChildCategoryQuery rightJoinCategoryImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryImage relation
* @method ChildCategoryQuery innerJoinCategoryImage($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryImage relation
@@ -720,152 +712,6 @@ abstract class CategoryQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'ProductCategory', '\Thelia\Model\ProductCategoryQuery');
}
/**
* Filter the query by a related \Thelia\Model\FeatureCategory object
*
* @param \Thelia\Model\FeatureCategory|ObjectCollection $featureCategory the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryQuery The current query, for fluid interface
*/
public function filterByFeatureCategory($featureCategory, $comparison = null)
{
if ($featureCategory instanceof \Thelia\Model\FeatureCategory) {
return $this
->addUsingAlias(CategoryTableMap::ID, $featureCategory->getCategoryId(), $comparison);
} elseif ($featureCategory instanceof ObjectCollection) {
return $this
->useFeatureCategoryQuery()
->filterByPrimaryKeys($featureCategory->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByFeatureCategory() only accepts arguments of type \Thelia\Model\FeatureCategory or Collection');
}
}
/**
* Adds a JOIN clause to the query using the FeatureCategory relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCategoryQuery The current query, for fluid interface
*/
public function joinFeatureCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('FeatureCategory');
// 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, 'FeatureCategory');
}
return $this;
}
/**
* Use the FeatureCategory relation FeatureCategory 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\FeatureCategoryQuery A secondary query class using the current class as primary query
*/
public function useFeatureCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinFeatureCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'FeatureCategory', '\Thelia\Model\FeatureCategoryQuery');
}
/**
* Filter the query by a related \Thelia\Model\AttributeCategory object
*
* @param \Thelia\Model\AttributeCategory|ObjectCollection $attributeCategory the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryQuery The current query, for fluid interface
*/
public function filterByAttributeCategory($attributeCategory, $comparison = null)
{
if ($attributeCategory instanceof \Thelia\Model\AttributeCategory) {
return $this
->addUsingAlias(CategoryTableMap::ID, $attributeCategory->getCategoryId(), $comparison);
} elseif ($attributeCategory instanceof ObjectCollection) {
return $this
->useAttributeCategoryQuery()
->filterByPrimaryKeys($attributeCategory->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAttributeCategory() only accepts arguments of type \Thelia\Model\AttributeCategory or Collection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeCategory relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCategoryQuery The current query, for fluid interface
*/
public function joinAttributeCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeCategory');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'AttributeCategory');
}
return $this;
}
/**
* Use the AttributeCategory relation AttributeCategory object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\AttributeCategoryQuery A secondary query class using the current class as primary query
*/
public function useAttributeCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
}
/**
* Filter the query by a related \Thelia\Model\CategoryImage object
*
@@ -1248,40 +1094,6 @@ abstract class CategoryQuery extends ModelCriteria
->endUse();
}
/**
* Filter the query by a related Feature object
* using the feature_category table as cross reference
*
* @param Feature $feature the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryQuery The current query, for fluid interface
*/
public function filterByFeature($feature, $comparison = Criteria::EQUAL)
{
return $this
->useFeatureCategoryQuery()
->filterByFeature($feature, $comparison)
->endUse();
}
/**
* Filter the query by a related Attribute object
* using the attribute_category table as cross reference
*
* @param Attribute $attribute the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryQuery The current query, for fluid interface
*/
public function filterByAttribute($attribute, $comparison = Criteria::EQUAL)
{
return $this
->useAttributeCategoryQuery()
->filterByAttribute($attribute, $comparison)
->endUse();
}
/**
* Exclude object from result
*

View File

@@ -135,6 +135,18 @@ abstract class Customer implements ActiveRecordInterface
*/
protected $discount;
/**
* The value for the remember_me_token field.
* @var string
*/
protected $remember_me_token;
/**
* The value for the remember_me_serial field.
* @var string
*/
protected $remember_me_serial;
/**
* The value for the created_at field.
* @var string
@@ -582,6 +594,28 @@ abstract class Customer implements ActiveRecordInterface
return $this->discount;
}
/**
* Get the [remember_me_token] column value.
*
* @return string
*/
public function getRememberMeToken()
{
return $this->remember_me_token;
}
/**
* Get the [remember_me_serial] column value.
*
* @return string
*/
public function getRememberMeSerial()
{
return $this->remember_me_serial;
}
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -878,6 +912,48 @@ abstract class Customer implements ActiveRecordInterface
return $this;
} // setDiscount()
/**
* Set the value of [remember_me_token] column.
*
* @param string $v new value
* @return \Thelia\Model\Customer The current object (for fluent API support)
*/
public function setRememberMeToken($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->remember_me_token !== $v) {
$this->remember_me_token = $v;
$this->modifiedColumns[] = CustomerTableMap::REMEMBER_ME_TOKEN;
}
return $this;
} // setRememberMeToken()
/**
* Set the value of [remember_me_serial] column.
*
* @param string $v new value
* @return \Thelia\Model\Customer The current object (for fluent API support)
*/
public function setRememberMeSerial($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->remember_me_serial !== $v) {
$this->remember_me_serial = $v;
$this->modifiedColumns[] = CustomerTableMap::REMEMBER_ME_SERIAL;
}
return $this;
} // setRememberMeSerial()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -993,13 +1069,19 @@ abstract class Customer implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CustomerTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)];
$this->discount = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CustomerTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CustomerTableMap::translateFieldName('RememberMeToken', TableMap::TYPE_PHPNAME, $indexType)];
$this->remember_me_token = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CustomerTableMap::translateFieldName('RememberMeSerial', TableMap::TYPE_PHPNAME, $indexType)];
$this->remember_me_serial = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CustomerTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CustomerTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CustomerTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -1012,7 +1094,7 @@ abstract class Customer implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 14; // 14 = CustomerTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 16; // 16 = CustomerTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Customer object", 0, $e);
@@ -1342,6 +1424,12 @@ abstract class Customer implements ActiveRecordInterface
if ($this->isColumnModified(CustomerTableMap::DISCOUNT)) {
$modifiedColumns[':p' . $index++] = 'DISCOUNT';
}
if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_TOKEN)) {
$modifiedColumns[':p' . $index++] = 'REMEMBER_ME_TOKEN';
}
if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_SERIAL)) {
$modifiedColumns[':p' . $index++] = 'REMEMBER_ME_SERIAL';
}
if ($this->isColumnModified(CustomerTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1395,6 +1483,12 @@ abstract class Customer implements ActiveRecordInterface
case 'DISCOUNT':
$stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR);
break;
case 'REMEMBER_ME_TOKEN':
$stmt->bindValue($identifier, $this->remember_me_token, PDO::PARAM_STR);
break;
case 'REMEMBER_ME_SERIAL':
$stmt->bindValue($identifier, $this->remember_me_serial, PDO::PARAM_STR);
break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1500,9 +1594,15 @@ abstract class Customer implements ActiveRecordInterface
return $this->getDiscount();
break;
case 12:
return $this->getCreatedAt();
return $this->getRememberMeToken();
break;
case 13:
return $this->getRememberMeSerial();
break;
case 14:
return $this->getCreatedAt();
break;
case 15:
return $this->getUpdatedAt();
break;
default:
@@ -1546,8 +1646,10 @@ abstract class Customer implements ActiveRecordInterface
$keys[9] => $this->getLang(),
$keys[10] => $this->getSponsor(),
$keys[11] => $this->getDiscount(),
$keys[12] => $this->getCreatedAt(),
$keys[13] => $this->getUpdatedAt(),
$keys[12] => $this->getRememberMeToken(),
$keys[13] => $this->getRememberMeSerial(),
$keys[14] => $this->getCreatedAt(),
$keys[15] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1639,9 +1741,15 @@ abstract class Customer implements ActiveRecordInterface
$this->setDiscount($value);
break;
case 12:
$this->setCreatedAt($value);
$this->setRememberMeToken($value);
break;
case 13:
$this->setRememberMeSerial($value);
break;
case 14:
$this->setCreatedAt($value);
break;
case 15:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1680,8 +1788,10 @@ abstract class Customer implements ActiveRecordInterface
if (array_key_exists($keys[9], $arr)) $this->setLang($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setSponsor($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setDiscount($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
if (array_key_exists($keys[12], $arr)) $this->setRememberMeToken($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setRememberMeSerial($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setCreatedAt($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setUpdatedAt($arr[$keys[15]]);
}
/**
@@ -1705,6 +1815,8 @@ abstract class Customer implements ActiveRecordInterface
if ($this->isColumnModified(CustomerTableMap::LANG)) $criteria->add(CustomerTableMap::LANG, $this->lang);
if ($this->isColumnModified(CustomerTableMap::SPONSOR)) $criteria->add(CustomerTableMap::SPONSOR, $this->sponsor);
if ($this->isColumnModified(CustomerTableMap::DISCOUNT)) $criteria->add(CustomerTableMap::DISCOUNT, $this->discount);
if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_TOKEN)) $criteria->add(CustomerTableMap::REMEMBER_ME_TOKEN, $this->remember_me_token);
if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_SERIAL)) $criteria->add(CustomerTableMap::REMEMBER_ME_SERIAL, $this->remember_me_serial);
if ($this->isColumnModified(CustomerTableMap::CREATED_AT)) $criteria->add(CustomerTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(CustomerTableMap::UPDATED_AT)) $criteria->add(CustomerTableMap::UPDATED_AT, $this->updated_at);
@@ -1781,6 +1893,8 @@ abstract class Customer implements ActiveRecordInterface
$copyObj->setLang($this->getLang());
$copyObj->setSponsor($this->getSponsor());
$copyObj->setDiscount($this->getDiscount());
$copyObj->setRememberMeToken($this->getRememberMeToken());
$copyObj->setRememberMeSerial($this->getRememberMeSerial());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -2806,6 +2920,8 @@ abstract class Customer implements ActiveRecordInterface
$this->lang = null;
$this->sponsor = null;
$this->discount = null;
$this->remember_me_token = null;
$this->remember_me_serial = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;

View File

@@ -33,6 +33,8 @@ use Thelia\Model\Map\CustomerTableMap;
* @method ChildCustomerQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method ChildCustomerQuery orderBySponsor($order = Criteria::ASC) Order by the sponsor column
* @method ChildCustomerQuery orderByDiscount($order = Criteria::ASC) Order by the discount column
* @method ChildCustomerQuery orderByRememberMeToken($order = Criteria::ASC) Order by the remember_me_token column
* @method ChildCustomerQuery orderByRememberMeSerial($order = Criteria::ASC) Order by the remember_me_serial column
* @method ChildCustomerQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCustomerQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -48,6 +50,8 @@ use Thelia\Model\Map\CustomerTableMap;
* @method ChildCustomerQuery groupByLang() Group by the lang column
* @method ChildCustomerQuery groupBySponsor() Group by the sponsor column
* @method ChildCustomerQuery groupByDiscount() Group by the discount column
* @method ChildCustomerQuery groupByRememberMeToken() Group by the remember_me_token column
* @method ChildCustomerQuery groupByRememberMeSerial() Group by the remember_me_serial column
* @method ChildCustomerQuery groupByCreatedAt() Group by the created_at column
* @method ChildCustomerQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -86,6 +90,8 @@ use Thelia\Model\Map\CustomerTableMap;
* @method ChildCustomer findOneByLang(string $lang) Return the first ChildCustomer filtered by the lang column
* @method ChildCustomer findOneBySponsor(string $sponsor) Return the first ChildCustomer filtered by the sponsor column
* @method ChildCustomer findOneByDiscount(double $discount) Return the first ChildCustomer filtered by the discount column
* @method ChildCustomer findOneByRememberMeToken(string $remember_me_token) Return the first ChildCustomer filtered by the remember_me_token column
* @method ChildCustomer findOneByRememberMeSerial(string $remember_me_serial) Return the first ChildCustomer filtered by the remember_me_serial column
* @method ChildCustomer findOneByCreatedAt(string $created_at) Return the first ChildCustomer filtered by the created_at column
* @method ChildCustomer findOneByUpdatedAt(string $updated_at) Return the first ChildCustomer filtered by the updated_at column
*
@@ -101,6 +107,8 @@ use Thelia\Model\Map\CustomerTableMap;
* @method array findByLang(string $lang) Return ChildCustomer objects filtered by the lang column
* @method array findBySponsor(string $sponsor) Return ChildCustomer objects filtered by the sponsor column
* @method array findByDiscount(double $discount) Return ChildCustomer objects filtered by the discount column
* @method array findByRememberMeToken(string $remember_me_token) Return ChildCustomer objects filtered by the remember_me_token column
* @method array findByRememberMeSerial(string $remember_me_serial) Return ChildCustomer objects filtered by the remember_me_serial column
* @method array findByCreatedAt(string $created_at) Return ChildCustomer objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCustomer objects filtered by the updated_at column
*
@@ -191,7 +199,7 @@ abstract class CustomerQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, REF, TITLE_ID, FIRSTNAME, LASTNAME, EMAIL, PASSWORD, ALGO, RESELLER, LANG, SPONSOR, DISCOUNT, CREATED_AT, UPDATED_AT FROM customer WHERE ID = :p0';
$sql = 'SELECT ID, REF, TITLE_ID, FIRSTNAME, LASTNAME, EMAIL, PASSWORD, ALGO, RESELLER, LANG, SPONSOR, DISCOUNT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM customer WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -678,6 +686,64 @@ abstract class CustomerQuery extends ModelCriteria
return $this->addUsingAlias(CustomerTableMap::DISCOUNT, $discount, $comparison);
}
/**
* Filter the query on the remember_me_token column
*
* Example usage:
* <code>
* $query->filterByRememberMeToken('fooValue'); // WHERE remember_me_token = 'fooValue'
* $query->filterByRememberMeToken('%fooValue%'); // WHERE remember_me_token LIKE '%fooValue%'
* </code>
*
* @param string $rememberMeToken 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 ChildCustomerQuery The current query, for fluid interface
*/
public function filterByRememberMeToken($rememberMeToken = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($rememberMeToken)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $rememberMeToken)) {
$rememberMeToken = str_replace('*', '%', $rememberMeToken);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerTableMap::REMEMBER_ME_TOKEN, $rememberMeToken, $comparison);
}
/**
* Filter the query on the remember_me_serial column
*
* Example usage:
* <code>
* $query->filterByRememberMeSerial('fooValue'); // WHERE remember_me_serial = 'fooValue'
* $query->filterByRememberMeSerial('%fooValue%'); // WHERE remember_me_serial LIKE '%fooValue%'
* </code>
*
* @param string $rememberMeSerial 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 ChildCustomerQuery The current query, for fluid interface
*/
public function filterByRememberMeSerial($rememberMeSerial = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($rememberMeSerial)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $rememberMeSerial)) {
$rememberMeSerial = str_replace('*', '%', $rememberMeSerial);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerTableMap::REMEMBER_ME_SERIAL, $rememberMeSerial, $comparison);
}
/**
* Filter the query on the created_at column
*

View File

@@ -17,18 +17,18 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Category as ChildCategory;
use Thelia\Model\CategoryQuery as ChildCategoryQuery;
use Thelia\Model\Feature as ChildFeature;
use Thelia\Model\FeatureAv as ChildFeatureAv;
use Thelia\Model\FeatureAvQuery as ChildFeatureAvQuery;
use Thelia\Model\FeatureCategory as ChildFeatureCategory;
use Thelia\Model\FeatureCategoryQuery as ChildFeatureCategoryQuery;
use Thelia\Model\FeatureI18n as ChildFeatureI18n;
use Thelia\Model\FeatureI18nQuery as ChildFeatureI18nQuery;
use Thelia\Model\FeatureProduct as ChildFeatureProduct;
use Thelia\Model\FeatureProductQuery as ChildFeatureProductQuery;
use Thelia\Model\FeatureQuery as ChildFeatureQuery;
use Thelia\Model\FeatureTemplate as ChildFeatureTemplate;
use Thelia\Model\FeatureTemplateQuery as ChildFeatureTemplateQuery;
use Thelia\Model\Template as ChildTemplate;
use Thelia\Model\TemplateQuery as ChildTemplateQuery;
use Thelia\Model\Map\FeatureTableMap;
abstract class Feature implements ActiveRecordInterface
@@ -109,10 +109,10 @@ abstract class Feature implements ActiveRecordInterface
protected $collFeatureProductsPartial;
/**
* @var ObjectCollection|ChildFeatureCategory[] Collection to store aggregation of ChildFeatureCategory objects.
* @var ObjectCollection|ChildFeatureTemplate[] Collection to store aggregation of ChildFeatureTemplate objects.
*/
protected $collFeatureCategories;
protected $collFeatureCategoriesPartial;
protected $collFeatureTemplates;
protected $collFeatureTemplatesPartial;
/**
* @var ObjectCollection|ChildFeatureI18n[] Collection to store aggregation of ChildFeatureI18n objects.
@@ -121,9 +121,9 @@ abstract class Feature implements ActiveRecordInterface
protected $collFeatureI18nsPartial;
/**
* @var ChildCategory[] Collection to store aggregation of ChildCategory objects.
* @var ChildTemplate[] Collection to store aggregation of ChildTemplate objects.
*/
protected $collCategories;
protected $collTemplates;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -151,7 +151,7 @@ abstract class Feature implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $categoriesScheduledForDeletion = null;
protected $templatesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
@@ -169,7 +169,7 @@ abstract class Feature implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $featureCategoriesScheduledForDeletion = null;
protected $featureTemplatesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
@@ -756,11 +756,11 @@ abstract class Feature implements ActiveRecordInterface
$this->collFeatureProducts = null;
$this->collFeatureCategories = null;
$this->collFeatureTemplates = null;
$this->collFeatureI18ns = null;
$this->collCategories = null;
$this->collTemplates = null;
} // if (deep)
}
@@ -894,29 +894,29 @@ abstract class Feature implements ActiveRecordInterface
$this->resetModified();
}
if ($this->categoriesScheduledForDeletion !== null) {
if (!$this->categoriesScheduledForDeletion->isEmpty()) {
if ($this->templatesScheduledForDeletion !== null) {
if (!$this->templatesScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->categoriesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($remotePk, $pk);
foreach ($this->templatesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($pk, $remotePk);
}
FeatureCategoryQuery::create()
FeatureTemplateQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->categoriesScheduledForDeletion = null;
$this->templatesScheduledForDeletion = null;
}
foreach ($this->getCategories() as $category) {
if ($category->isModified()) {
$category->save($con);
foreach ($this->getTemplates() as $template) {
if ($template->isModified()) {
$template->save($con);
}
}
} elseif ($this->collCategories) {
foreach ($this->collCategories as $category) {
if ($category->isModified()) {
$category->save($con);
} elseif ($this->collTemplates) {
foreach ($this->collTemplates as $template) {
if ($template->isModified()) {
$template->save($con);
}
}
}
@@ -955,17 +955,17 @@ abstract class Feature implements ActiveRecordInterface
}
}
if ($this->featureCategoriesScheduledForDeletion !== null) {
if (!$this->featureCategoriesScheduledForDeletion->isEmpty()) {
\Thelia\Model\FeatureCategoryQuery::create()
->filterByPrimaryKeys($this->featureCategoriesScheduledForDeletion->getPrimaryKeys(false))
if ($this->featureTemplatesScheduledForDeletion !== null) {
if (!$this->featureTemplatesScheduledForDeletion->isEmpty()) {
\Thelia\Model\FeatureTemplateQuery::create()
->filterByPrimaryKeys($this->featureTemplatesScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->featureCategoriesScheduledForDeletion = null;
$this->featureTemplatesScheduledForDeletion = null;
}
}
if ($this->collFeatureCategories !== null) {
foreach ($this->collFeatureCategories as $referrerFK) {
if ($this->collFeatureTemplates !== null) {
foreach ($this->collFeatureTemplates as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
@@ -1181,8 +1181,8 @@ abstract class Feature implements ActiveRecordInterface
if (null !== $this->collFeatureProducts) {
$result['FeatureProducts'] = $this->collFeatureProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collFeatureCategories) {
$result['FeatureCategories'] = $this->collFeatureCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
if (null !== $this->collFeatureTemplates) {
$result['FeatureTemplates'] = $this->collFeatureTemplates->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collFeatureI18ns) {
$result['FeatureI18ns'] = $this->collFeatureI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
@@ -1366,9 +1366,9 @@ abstract class Feature implements ActiveRecordInterface
}
}
foreach ($this->getFeatureCategories() as $relObj) {
foreach ($this->getFeatureTemplates() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addFeatureCategory($relObj->copy($deepCopy));
$copyObj->addFeatureTemplate($relObj->copy($deepCopy));
}
}
@@ -1425,8 +1425,8 @@ abstract class Feature implements ActiveRecordInterface
if ('FeatureProduct' == $relationName) {
return $this->initFeatureProducts();
}
if ('FeatureCategory' == $relationName) {
return $this->initFeatureCategories();
if ('FeatureTemplate' == $relationName) {
return $this->initFeatureTemplates();
}
if ('FeatureI18n' == $relationName) {
return $this->initFeatureI18ns();
@@ -1920,31 +1920,31 @@ abstract class Feature implements ActiveRecordInterface
}
/**
* Clears out the collFeatureCategories collection
* Clears out the collFeatureTemplates collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @see addFeatureCategories()
* @see addFeatureTemplates()
*/
public function clearFeatureCategories()
public function clearFeatureTemplates()
{
$this->collFeatureCategories = null; // important to set this to NULL since that means it is uninitialized
$this->collFeatureTemplates = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collFeatureCategories collection loaded partially.
* Reset is the collFeatureTemplates collection loaded partially.
*/
public function resetPartialFeatureCategories($v = true)
public function resetPartialFeatureTemplates($v = true)
{
$this->collFeatureCategoriesPartial = $v;
$this->collFeatureTemplatesPartial = $v;
}
/**
* Initializes the collFeatureCategories collection.
* Initializes the collFeatureTemplates collection.
*
* By default this just sets the collFeatureCategories collection to an empty array (like clearcollFeatureCategories());
* By default this just sets the collFeatureTemplates collection to an empty array (like clearcollFeatureTemplates());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
@@ -1953,17 +1953,17 @@ abstract class Feature implements ActiveRecordInterface
*
* @return void
*/
public function initFeatureCategories($overrideExisting = true)
public function initFeatureTemplates($overrideExisting = true)
{
if (null !== $this->collFeatureCategories && !$overrideExisting) {
if (null !== $this->collFeatureTemplates && !$overrideExisting) {
return;
}
$this->collFeatureCategories = new ObjectCollection();
$this->collFeatureCategories->setModel('\Thelia\Model\FeatureCategory');
$this->collFeatureTemplates = new ObjectCollection();
$this->collFeatureTemplates->setModel('\Thelia\Model\FeatureTemplate');
}
/**
* Gets an array of ChildFeatureCategory objects which contain a foreign key that references this object.
* Gets an array of ChildFeatureTemplate objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -1973,109 +1973,109 @@ abstract class Feature implements ActiveRecordInterface
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @return Collection|ChildFeatureCategory[] List of ChildFeatureCategory objects
* @return Collection|ChildFeatureTemplate[] List of ChildFeatureTemplate objects
* @throws PropelException
*/
public function getFeatureCategories($criteria = null, ConnectionInterface $con = null)
public function getFeatureTemplates($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collFeatureCategoriesPartial && !$this->isNew();
if (null === $this->collFeatureCategories || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collFeatureCategories) {
$partial = $this->collFeatureTemplatesPartial && !$this->isNew();
if (null === $this->collFeatureTemplates || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collFeatureTemplates) {
// return empty collection
$this->initFeatureCategories();
$this->initFeatureTemplates();
} else {
$collFeatureCategories = ChildFeatureCategoryQuery::create(null, $criteria)
$collFeatureTemplates = ChildFeatureTemplateQuery::create(null, $criteria)
->filterByFeature($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collFeatureCategoriesPartial && count($collFeatureCategories)) {
$this->initFeatureCategories(false);
if (false !== $this->collFeatureTemplatesPartial && count($collFeatureTemplates)) {
$this->initFeatureTemplates(false);
foreach ($collFeatureCategories as $obj) {
if (false == $this->collFeatureCategories->contains($obj)) {
$this->collFeatureCategories->append($obj);
foreach ($collFeatureTemplates as $obj) {
if (false == $this->collFeatureTemplates->contains($obj)) {
$this->collFeatureTemplates->append($obj);
}
}
$this->collFeatureCategoriesPartial = true;
$this->collFeatureTemplatesPartial = true;
}
$collFeatureCategories->getInternalIterator()->rewind();
$collFeatureTemplates->getInternalIterator()->rewind();
return $collFeatureCategories;
return $collFeatureTemplates;
}
if ($partial && $this->collFeatureCategories) {
foreach ($this->collFeatureCategories as $obj) {
if ($partial && $this->collFeatureTemplates) {
foreach ($this->collFeatureTemplates as $obj) {
if ($obj->isNew()) {
$collFeatureCategories[] = $obj;
$collFeatureTemplates[] = $obj;
}
}
}
$this->collFeatureCategories = $collFeatureCategories;
$this->collFeatureCategoriesPartial = false;
$this->collFeatureTemplates = $collFeatureTemplates;
$this->collFeatureTemplatesPartial = false;
}
}
return $this->collFeatureCategories;
return $this->collFeatureTemplates;
}
/**
* Sets a collection of FeatureCategory objects related by a one-to-many relationship
* Sets a collection of FeatureTemplate objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
* @param Collection $featureCategories A Propel collection.
* @param Collection $featureTemplates A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildFeature The current object (for fluent API support)
*/
public function setFeatureCategories(Collection $featureCategories, ConnectionInterface $con = null)
public function setFeatureTemplates(Collection $featureTemplates, ConnectionInterface $con = null)
{
$featureCategoriesToDelete = $this->getFeatureCategories(new Criteria(), $con)->diff($featureCategories);
$featureTemplatesToDelete = $this->getFeatureTemplates(new Criteria(), $con)->diff($featureTemplates);
$this->featureCategoriesScheduledForDeletion = $featureCategoriesToDelete;
$this->featureTemplatesScheduledForDeletion = $featureTemplatesToDelete;
foreach ($featureCategoriesToDelete as $featureCategoryRemoved) {
$featureCategoryRemoved->setFeature(null);
foreach ($featureTemplatesToDelete as $featureTemplateRemoved) {
$featureTemplateRemoved->setFeature(null);
}
$this->collFeatureCategories = null;
foreach ($featureCategories as $featureCategory) {
$this->addFeatureCategory($featureCategory);
$this->collFeatureTemplates = null;
foreach ($featureTemplates as $featureTemplate) {
$this->addFeatureTemplate($featureTemplate);
}
$this->collFeatureCategories = $featureCategories;
$this->collFeatureCategoriesPartial = false;
$this->collFeatureTemplates = $featureTemplates;
$this->collFeatureTemplatesPartial = false;
return $this;
}
/**
* Returns the number of related FeatureCategory objects.
* Returns the number of related FeatureTemplate objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related FeatureCategory objects.
* @return int Count of related FeatureTemplate objects.
* @throws PropelException
*/
public function countFeatureCategories(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
public function countFeatureTemplates(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collFeatureCategoriesPartial && !$this->isNew();
if (null === $this->collFeatureCategories || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collFeatureCategories) {
$partial = $this->collFeatureTemplatesPartial && !$this->isNew();
if (null === $this->collFeatureTemplates || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collFeatureTemplates) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getFeatureCategories());
return count($this->getFeatureTemplates());
}
$query = ChildFeatureCategoryQuery::create(null, $criteria);
$query = ChildFeatureTemplateQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -2085,53 +2085,53 @@ abstract class Feature implements ActiveRecordInterface
->count($con);
}
return count($this->collFeatureCategories);
return count($this->collFeatureTemplates);
}
/**
* Method called to associate a ChildFeatureCategory object to this object
* through the ChildFeatureCategory foreign key attribute.
* Method called to associate a ChildFeatureTemplate object to this object
* through the ChildFeatureTemplate foreign key attribute.
*
* @param ChildFeatureCategory $l ChildFeatureCategory
* @param ChildFeatureTemplate $l ChildFeatureTemplate
* @return \Thelia\Model\Feature The current object (for fluent API support)
*/
public function addFeatureCategory(ChildFeatureCategory $l)
public function addFeatureTemplate(ChildFeatureTemplate $l)
{
if ($this->collFeatureCategories === null) {
$this->initFeatureCategories();
$this->collFeatureCategoriesPartial = true;
if ($this->collFeatureTemplates === null) {
$this->initFeatureTemplates();
$this->collFeatureTemplatesPartial = true;
}
if (!in_array($l, $this->collFeatureCategories->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddFeatureCategory($l);
if (!in_array($l, $this->collFeatureTemplates->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddFeatureTemplate($l);
}
return $this;
}
/**
* @param FeatureCategory $featureCategory The featureCategory object to add.
* @param FeatureTemplate $featureTemplate The featureTemplate object to add.
*/
protected function doAddFeatureCategory($featureCategory)
protected function doAddFeatureTemplate($featureTemplate)
{
$this->collFeatureCategories[]= $featureCategory;
$featureCategory->setFeature($this);
$this->collFeatureTemplates[]= $featureTemplate;
$featureTemplate->setFeature($this);
}
/**
* @param FeatureCategory $featureCategory The featureCategory object to remove.
* @param FeatureTemplate $featureTemplate The featureTemplate object to remove.
* @return ChildFeature The current object (for fluent API support)
*/
public function removeFeatureCategory($featureCategory)
public function removeFeatureTemplate($featureTemplate)
{
if ($this->getFeatureCategories()->contains($featureCategory)) {
$this->collFeatureCategories->remove($this->collFeatureCategories->search($featureCategory));
if (null === $this->featureCategoriesScheduledForDeletion) {
$this->featureCategoriesScheduledForDeletion = clone $this->collFeatureCategories;
$this->featureCategoriesScheduledForDeletion->clear();
if ($this->getFeatureTemplates()->contains($featureTemplate)) {
$this->collFeatureTemplates->remove($this->collFeatureTemplates->search($featureTemplate));
if (null === $this->featureTemplatesScheduledForDeletion) {
$this->featureTemplatesScheduledForDeletion = clone $this->collFeatureTemplates;
$this->featureTemplatesScheduledForDeletion->clear();
}
$this->featureCategoriesScheduledForDeletion[]= clone $featureCategory;
$featureCategory->setFeature(null);
$this->featureTemplatesScheduledForDeletion[]= clone $featureTemplate;
$featureTemplate->setFeature(null);
}
return $this;
@@ -2143,7 +2143,7 @@ abstract class Feature implements ActiveRecordInterface
* an identical criteria, it returns the collection.
* Otherwise if this Feature is new, it will return
* an empty collection; or if this Feature has previously
* been saved, it will retrieve related FeatureCategories from storage.
* been saved, it will retrieve related FeatureTemplates from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
@@ -2152,14 +2152,14 @@ abstract class Feature implements ActiveRecordInterface
* @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|ChildFeatureCategory[] List of ChildFeatureCategory objects
* @return Collection|ChildFeatureTemplate[] List of ChildFeatureTemplate objects
*/
public function getFeatureCategoriesJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
public function getFeatureTemplatesJoinTemplate($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildFeatureCategoryQuery::create(null, $criteria);
$query->joinWith('Category', $joinBehavior);
$query = ChildFeatureTemplateQuery::create(null, $criteria);
$query->joinWith('Template', $joinBehavior);
return $this->getFeatureCategories($query, $con);
return $this->getFeatureTemplates($query, $con);
}
/**
@@ -2388,38 +2388,38 @@ abstract class Feature implements ActiveRecordInterface
}
/**
* Clears out the collCategories collection
* Clears out the collTemplates collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @see addCategories()
* @see addTemplates()
*/
public function clearCategories()
public function clearTemplates()
{
$this->collCategories = null; // important to set this to NULL since that means it is uninitialized
$this->collCategoriesPartial = null;
$this->collTemplates = null; // important to set this to NULL since that means it is uninitialized
$this->collTemplatesPartial = null;
}
/**
* Initializes the collCategories collection.
* Initializes the collTemplates collection.
*
* By default this just sets the collCategories collection to an empty collection (like clearCategories());
* By default this just sets the collTemplates collection to an empty collection (like clearTemplates());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
* @return void
*/
public function initCategories()
public function initTemplates()
{
$this->collCategories = new ObjectCollection();
$this->collCategories->setModel('\Thelia\Model\Category');
$this->collTemplates = new ObjectCollection();
$this->collTemplates->setModel('\Thelia\Model\Template');
}
/**
* Gets a collection of ChildCategory objects related by a many-to-many relationship
* to the current object by way of the feature_category cross-reference table.
* Gets a collection of ChildTemplate objects related by a many-to-many relationship
* to the current object by way of the feature_template cross-reference table.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -2430,73 +2430,73 @@ abstract class Feature implements ActiveRecordInterface
* @param Criteria $criteria Optional query object to filter the query
* @param ConnectionInterface $con Optional connection object
*
* @return ObjectCollection|ChildCategory[] List of ChildCategory objects
* @return ObjectCollection|ChildTemplate[] List of ChildTemplate objects
*/
public function getCategories($criteria = null, ConnectionInterface $con = null)
public function getTemplates($criteria = null, ConnectionInterface $con = null)
{
if (null === $this->collCategories || null !== $criteria) {
if ($this->isNew() && null === $this->collCategories) {
if (null === $this->collTemplates || null !== $criteria) {
if ($this->isNew() && null === $this->collTemplates) {
// return empty collection
$this->initCategories();
$this->initTemplates();
} else {
$collCategories = ChildCategoryQuery::create(null, $criteria)
$collTemplates = ChildTemplateQuery::create(null, $criteria)
->filterByFeature($this)
->find($con);
if (null !== $criteria) {
return $collCategories;
return $collTemplates;
}
$this->collCategories = $collCategories;
$this->collTemplates = $collTemplates;
}
}
return $this->collCategories;
return $this->collTemplates;
}
/**
* Sets a collection of Category objects related by a many-to-many relationship
* to the current object by way of the feature_category cross-reference table.
* Sets a collection of Template objects related by a many-to-many relationship
* to the current object by way of the feature_template cross-reference table.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
* @param Collection $categories A Propel collection.
* @param Collection $templates A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildFeature The current object (for fluent API support)
*/
public function setCategories(Collection $categories, ConnectionInterface $con = null)
public function setTemplates(Collection $templates, ConnectionInterface $con = null)
{
$this->clearCategories();
$currentCategories = $this->getCategories();
$this->clearTemplates();
$currentTemplates = $this->getTemplates();
$this->categoriesScheduledForDeletion = $currentCategories->diff($categories);
$this->templatesScheduledForDeletion = $currentTemplates->diff($templates);
foreach ($categories as $category) {
if (!$currentCategories->contains($category)) {
$this->doAddCategory($category);
foreach ($templates as $template) {
if (!$currentTemplates->contains($template)) {
$this->doAddTemplate($template);
}
}
$this->collCategories = $categories;
$this->collTemplates = $templates;
return $this;
}
/**
* Gets the number of ChildCategory objects related by a many-to-many relationship
* to the current object by way of the feature_category cross-reference table.
* Gets the number of ChildTemplate objects related by a many-to-many relationship
* to the current object by way of the feature_template cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param ConnectionInterface $con Optional connection object
*
* @return int the number of related ChildCategory objects
* @return int the number of related ChildTemplate objects
*/
public function countCategories($criteria = null, $distinct = false, ConnectionInterface $con = null)
public function countTemplates($criteria = null, $distinct = false, ConnectionInterface $con = null)
{
if (null === $this->collCategories || null !== $criteria) {
if ($this->isNew() && null === $this->collCategories) {
if (null === $this->collTemplates || null !== $criteria) {
if ($this->isNew() && null === $this->collTemplates) {
return 0;
} else {
$query = ChildCategoryQuery::create(null, $criteria);
$query = ChildTemplateQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -2506,65 +2506,65 @@ abstract class Feature implements ActiveRecordInterface
->count($con);
}
} else {
return count($this->collCategories);
return count($this->collTemplates);
}
}
/**
* Associate a ChildCategory object to this object
* through the feature_category cross reference table.
* Associate a ChildTemplate object to this object
* through the feature_template cross reference table.
*
* @param ChildCategory $category The ChildFeatureCategory object to relate
* @param ChildTemplate $template The ChildFeatureTemplate object to relate
* @return ChildFeature The current object (for fluent API support)
*/
public function addCategory(ChildCategory $category)
public function addTemplate(ChildTemplate $template)
{
if ($this->collCategories === null) {
$this->initCategories();
if ($this->collTemplates === null) {
$this->initTemplates();
}
if (!$this->collCategories->contains($category)) { // only add it if the **same** object is not already associated
$this->doAddCategory($category);
$this->collCategories[] = $category;
if (!$this->collTemplates->contains($template)) { // only add it if the **same** object is not already associated
$this->doAddTemplate($template);
$this->collTemplates[] = $template;
}
return $this;
}
/**
* @param Category $category The category object to add.
* @param Template $template The template object to add.
*/
protected function doAddCategory($category)
protected function doAddTemplate($template)
{
$featureCategory = new ChildFeatureCategory();
$featureCategory->setCategory($category);
$this->addFeatureCategory($featureCategory);
$featureTemplate = new ChildFeatureTemplate();
$featureTemplate->setTemplate($template);
$this->addFeatureTemplate($featureTemplate);
// set the back reference to this object directly as using provided method either results
// in endless loop or in multiple relations
if (!$category->getFeatures()->contains($this)) {
$foreignCollection = $category->getFeatures();
if (!$template->getFeatures()->contains($this)) {
$foreignCollection = $template->getFeatures();
$foreignCollection[] = $this;
}
}
/**
* Remove a ChildCategory object to this object
* through the feature_category cross reference table.
* Remove a ChildTemplate object to this object
* through the feature_template cross reference table.
*
* @param ChildCategory $category The ChildFeatureCategory object to relate
* @param ChildTemplate $template The ChildFeatureTemplate object to relate
* @return ChildFeature The current object (for fluent API support)
*/
public function removeCategory(ChildCategory $category)
public function removeTemplate(ChildTemplate $template)
{
if ($this->getCategories()->contains($category)) {
$this->collCategories->remove($this->collCategories->search($category));
if ($this->getTemplates()->contains($template)) {
$this->collTemplates->remove($this->collTemplates->search($template));
if (null === $this->categoriesScheduledForDeletion) {
$this->categoriesScheduledForDeletion = clone $this->collCategories;
$this->categoriesScheduledForDeletion->clear();
if (null === $this->templatesScheduledForDeletion) {
$this->templatesScheduledForDeletion = clone $this->collTemplates;
$this->templatesScheduledForDeletion->clear();
}
$this->categoriesScheduledForDeletion[] = $category;
$this->templatesScheduledForDeletion[] = $template;
}
return $this;
@@ -2610,8 +2610,8 @@ abstract class Feature implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collFeatureCategories) {
foreach ($this->collFeatureCategories as $o) {
if ($this->collFeatureTemplates) {
foreach ($this->collFeatureTemplates as $o) {
$o->clearAllReferences($deep);
}
}
@@ -2620,8 +2620,8 @@ abstract class Feature implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collCategories) {
foreach ($this->collCategories as $o) {
if ($this->collTemplates) {
foreach ($this->collTemplates as $o) {
$o->clearAllReferences($deep);
}
}
@@ -2639,18 +2639,18 @@ abstract class Feature implements ActiveRecordInterface
$this->collFeatureProducts->clearIterator();
}
$this->collFeatureProducts = null;
if ($this->collFeatureCategories instanceof Collection) {
$this->collFeatureCategories->clearIterator();
if ($this->collFeatureTemplates instanceof Collection) {
$this->collFeatureTemplates->clearIterator();
}
$this->collFeatureCategories = null;
$this->collFeatureTemplates = null;
if ($this->collFeatureI18ns instanceof Collection) {
$this->collFeatureI18ns->clearIterator();
}
$this->collFeatureI18ns = null;
if ($this->collCategories instanceof Collection) {
$this->collCategories->clearIterator();
if ($this->collTemplates instanceof Collection) {
$this->collTemplates->clearIterator();
}
$this->collCategories = null;
$this->collTemplates = null;
}
/**

View File

@@ -46,9 +46,9 @@ use Thelia\Model\Map\FeatureTableMap;
* @method ChildFeatureQuery rightJoinFeatureProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureProduct relation
* @method ChildFeatureQuery innerJoinFeatureProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureProduct relation
*
* @method ChildFeatureQuery leftJoinFeatureCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureCategory relation
* @method ChildFeatureQuery rightJoinFeatureCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureCategory relation
* @method ChildFeatureQuery innerJoinFeatureCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureCategory relation
* @method ChildFeatureQuery leftJoinFeatureTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureTemplate relation
* @method ChildFeatureQuery rightJoinFeatureTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureTemplate relation
* @method ChildFeatureQuery innerJoinFeatureTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureTemplate relation
*
* @method ChildFeatureQuery leftJoinFeatureI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureI18n relation
* @method ChildFeatureQuery rightJoinFeatureI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureI18n relation
@@ -601,40 +601,40 @@ abstract class FeatureQuery extends ModelCriteria
}
/**
* Filter the query by a related \Thelia\Model\FeatureCategory object
* Filter the query by a related \Thelia\Model\FeatureTemplate object
*
* @param \Thelia\Model\FeatureCategory|ObjectCollection $featureCategory the related object to use as filter
* @param \Thelia\Model\FeatureTemplate|ObjectCollection $featureTemplate the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFeatureQuery The current query, for fluid interface
*/
public function filterByFeatureCategory($featureCategory, $comparison = null)
public function filterByFeatureTemplate($featureTemplate, $comparison = null)
{
if ($featureCategory instanceof \Thelia\Model\FeatureCategory) {
if ($featureTemplate instanceof \Thelia\Model\FeatureTemplate) {
return $this
->addUsingAlias(FeatureTableMap::ID, $featureCategory->getFeatureId(), $comparison);
} elseif ($featureCategory instanceof ObjectCollection) {
->addUsingAlias(FeatureTableMap::ID, $featureTemplate->getFeatureId(), $comparison);
} elseif ($featureTemplate instanceof ObjectCollection) {
return $this
->useFeatureCategoryQuery()
->filterByPrimaryKeys($featureCategory->getPrimaryKeys())
->useFeatureTemplateQuery()
->filterByPrimaryKeys($featureTemplate->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByFeatureCategory() only accepts arguments of type \Thelia\Model\FeatureCategory or Collection');
throw new PropelException('filterByFeatureTemplate() only accepts arguments of type \Thelia\Model\FeatureTemplate or Collection');
}
}
/**
* Adds a JOIN clause to the query using the FeatureCategory relation
* Adds a JOIN clause to the query using the FeatureTemplate relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildFeatureQuery The current query, for fluid interface
*/
public function joinFeatureCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function joinFeatureTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('FeatureCategory');
$relationMap = $tableMap->getRelation('FeatureTemplate');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -649,14 +649,14 @@ abstract class FeatureQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'FeatureCategory');
$this->addJoinObject($join, 'FeatureTemplate');
}
return $this;
}
/**
* Use the FeatureCategory relation FeatureCategory object
* Use the FeatureTemplate relation FeatureTemplate object
*
* @see useQuery()
*
@@ -664,13 +664,13 @@ abstract class FeatureQuery extends ModelCriteria
* 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\FeatureCategoryQuery A secondary query class using the current class as primary query
* @return \Thelia\Model\FeatureTemplateQuery A secondary query class using the current class as primary query
*/
public function useFeatureCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function useFeatureTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinFeatureCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'FeatureCategory', '\Thelia\Model\FeatureCategoryQuery');
->joinFeatureTemplate($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'FeatureTemplate', '\Thelia\Model\FeatureTemplateQuery');
}
/**
@@ -747,19 +747,19 @@ abstract class FeatureQuery extends ModelCriteria
}
/**
* Filter the query by a related Category object
* using the feature_category table as cross reference
* Filter the query by a related Template object
* using the feature_template table as cross reference
*
* @param Category $category the related object to use as filter
* @param Template $template the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFeatureQuery The current query, for fluid interface
*/
public function filterByCategory($category, $comparison = Criteria::EQUAL)
public function filterByTemplate($template, $comparison = Criteria::EQUAL)
{
return $this
->useFeatureCategoryQuery()
->filterByCategory($category, $comparison)
->useFeatureTemplateQuery()
->filterByTemplate($template, $comparison)
->endUse();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,759 @@
<?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\FeatureTemplate as ChildFeatureTemplate;
use Thelia\Model\FeatureTemplateQuery as ChildFeatureTemplateQuery;
use Thelia\Model\Map\FeatureTemplateTableMap;
/**
* Base class that represents a query for the 'feature_template' table.
*
*
*
* @method ChildFeatureTemplateQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildFeatureTemplateQuery orderByFeatureId($order = Criteria::ASC) Order by the feature_id column
* @method ChildFeatureTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
* @method ChildFeatureTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildFeatureTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildFeatureTemplateQuery groupById() Group by the id column
* @method ChildFeatureTemplateQuery groupByFeatureId() Group by the feature_id column
* @method ChildFeatureTemplateQuery groupByTemplateId() Group by the template_id column
* @method ChildFeatureTemplateQuery groupByCreatedAt() Group by the created_at column
* @method ChildFeatureTemplateQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildFeatureTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildFeatureTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildFeatureTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildFeatureTemplateQuery leftJoinFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the Feature relation
* @method ChildFeatureTemplateQuery rightJoinFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Feature relation
* @method ChildFeatureTemplateQuery innerJoinFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the Feature relation
*
* @method ChildFeatureTemplateQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
* @method ChildFeatureTemplateQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
* @method ChildFeatureTemplateQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
*
* @method ChildFeatureTemplate findOne(ConnectionInterface $con = null) Return the first ChildFeatureTemplate matching the query
* @method ChildFeatureTemplate findOneOrCreate(ConnectionInterface $con = null) Return the first ChildFeatureTemplate matching the query, or a new ChildFeatureTemplate object populated from the query conditions when no match is found
*
* @method ChildFeatureTemplate findOneById(int $id) Return the first ChildFeatureTemplate filtered by the id column
* @method ChildFeatureTemplate findOneByFeatureId(int $feature_id) Return the first ChildFeatureTemplate filtered by the feature_id column
* @method ChildFeatureTemplate findOneByTemplateId(int $template_id) Return the first ChildFeatureTemplate filtered by the template_id column
* @method ChildFeatureTemplate findOneByCreatedAt(string $created_at) Return the first ChildFeatureTemplate filtered by the created_at column
* @method ChildFeatureTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildFeatureTemplate filtered by the updated_at column
*
* @method array findById(int $id) Return ChildFeatureTemplate objects filtered by the id column
* @method array findByFeatureId(int $feature_id) Return ChildFeatureTemplate objects filtered by the feature_id column
* @method array findByTemplateId(int $template_id) Return ChildFeatureTemplate objects filtered by the template_id column
* @method array findByCreatedAt(string $created_at) Return ChildFeatureTemplate objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildFeatureTemplate objects filtered by the updated_at column
*
*/
abstract class FeatureTemplateQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\FeatureTemplateQuery 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\\FeatureTemplate', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildFeatureTemplateQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildFeatureTemplateQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\FeatureTemplateQuery) {
return $criteria;
}
$query = new \Thelia\Model\FeatureTemplateQuery();
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 ChildFeatureTemplate|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = FeatureTemplateTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(FeatureTemplateTableMap::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 ChildFeatureTemplate A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, FEATURE_ID, TEMPLATE_ID, CREATED_AT, UPDATED_AT FROM feature_template 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 ChildFeatureTemplate();
$obj->hydrate($row);
FeatureTemplateTableMap::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 ChildFeatureTemplate|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 ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(FeatureTemplateTableMap::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 ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(FeatureTemplateTableMap::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 ChildFeatureTemplateQuery 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(FeatureTemplateTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(FeatureTemplateTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(FeatureTemplateTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the feature_id column
*
* Example usage:
* <code>
* $query->filterByFeatureId(1234); // WHERE feature_id = 1234
* $query->filterByFeatureId(array(12, 34)); // WHERE feature_id IN (12, 34)
* $query->filterByFeatureId(array('min' => 12)); // WHERE feature_id > 12
* </code>
*
* @see filterByFeature()
*
* @param mixed $featureId 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 ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function filterByFeatureId($featureId = null, $comparison = null)
{
if (is_array($featureId)) {
$useMinMax = false;
if (isset($featureId['min'])) {
$this->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $featureId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($featureId['max'])) {
$this->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $featureId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $featureId, $comparison);
}
/**
* Filter the query on the template_id column
*
* Example usage:
* <code>
* $query->filterByTemplateId(1234); // WHERE template_id = 1234
* $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
* $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
* </code>
*
* @see filterByTemplate()
*
* @param mixed $templateId 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 ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function filterByTemplateId($templateId = null, $comparison = null)
{
if (is_array($templateId)) {
$useMinMax = false;
if (isset($templateId['min'])) {
$this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($templateId['max'])) {
$this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId, $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 ChildFeatureTemplateQuery 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(FeatureTemplateTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(FeatureTemplateTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(FeatureTemplateTableMap::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 ChildFeatureTemplateQuery 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(FeatureTemplateTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(FeatureTemplateTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(FeatureTemplateTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Feature object
*
* @param \Thelia\Model\Feature|ObjectCollection $feature The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function filterByFeature($feature, $comparison = null)
{
if ($feature instanceof \Thelia\Model\Feature) {
return $this
->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $feature->getId(), $comparison);
} elseif ($feature instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(FeatureTemplateTableMap::FEATURE_ID, $feature->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByFeature() only accepts arguments of type \Thelia\Model\Feature or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Feature relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function joinFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Feature');
// 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, 'Feature');
}
return $this;
}
/**
* Use the Feature relation Feature 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\FeatureQuery A secondary query class using the current class as primary query
*/
public function useFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinFeature($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Feature', '\Thelia\Model\FeatureQuery');
}
/**
* Filter the query by a related \Thelia\Model\Template object
*
* @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function filterByTemplate($template, $comparison = null)
{
if ($template instanceof \Thelia\Model\Template) {
return $this
->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $template->getId(), $comparison);
} elseif ($template instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Template relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Template');
// 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, 'Template');
}
return $this;
}
/**
* Use the Template relation Template 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\TemplateQuery A secondary query class using the current class as primary query
*/
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinTemplate($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
}
/**
* Exclude object from result
*
* @param ChildFeatureTemplate $featureTemplate Object to remove from the list of results
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function prune($featureTemplate = null)
{
if ($featureTemplate) {
$this->addUsingAlias(FeatureTemplateTableMap::ID, $featureTemplate->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the feature_template 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(FeatureTemplateTableMap::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).
FeatureTemplateTableMap::clearInstancePool();
FeatureTemplateTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildFeatureTemplate or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildFeatureTemplate 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(FeatureTemplateTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(FeatureTemplateTableMap::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();
FeatureTemplateTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
FeatureTemplateTableMap::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 ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(FeatureTemplateTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(FeatureTemplateTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(FeatureTemplateTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(FeatureTemplateTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(FeatureTemplateTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(FeatureTemplateTableMap::CREATED_AT);
}
} // FeatureTemplateQuery

View File

@@ -43,6 +43,8 @@ use Thelia\Model\ProductVersion as ChildProductVersion;
use Thelia\Model\ProductVersionQuery as ChildProductVersionQuery;
use Thelia\Model\TaxRule as ChildTaxRule;
use Thelia\Model\TaxRuleQuery as ChildTaxRuleQuery;
use Thelia\Model\Template as ChildTemplate;
use Thelia\Model\TemplateQuery as ChildTemplateQuery;
use Thelia\Model\Map\ProductTableMap;
use Thelia\Model\Map\ProductVersionTableMap;
@@ -111,6 +113,12 @@ abstract class Product implements ActiveRecordInterface
*/
protected $position;
/**
* The value for the template_id field.
* @var int
*/
protected $template_id;
/**
* The value for the created_at field.
* @var string
@@ -147,6 +155,11 @@ abstract class Product implements ActiveRecordInterface
*/
protected $aTaxRule;
/**
* @var Template
*/
protected $aTemplate;
/**
* @var ObjectCollection|ChildProductCategory[] Collection to store aggregation of ChildProductCategory objects.
*/
@@ -665,6 +678,17 @@ abstract class Product implements ActiveRecordInterface
return $this->position;
}
/**
* Get the [template_id] column value.
*
* @return int
*/
public function getTemplateId()
{
return $this->template_id;
}
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -856,6 +880,31 @@ abstract class Product implements ActiveRecordInterface
return $this;
} // setPosition()
/**
* Set the value of [template_id] column.
*
* @param int $v new value
* @return \Thelia\Model\Product The current object (for fluent API support)
*/
public function setTemplateId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->template_id !== $v) {
$this->template_id = $v;
$this->modifiedColumns[] = ProductTableMap::TEMPLATE_ID;
}
if ($this->aTemplate !== null && $this->aTemplate->getId() !== $v) {
$this->aTemplate = null;
}
return $this;
} // setTemplateId()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -1021,28 +1070,31 @@ abstract class Product implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
$this->position = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductTableMap::translateFieldName('CreatedAt', 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;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductTableMap::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 ? 9 + $startcol : ProductTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified();
@@ -1052,7 +1104,7 @@ abstract class Product implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 10; // 10 = ProductTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 11; // 11 = ProductTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Product object", 0, $e);
@@ -1077,6 +1129,9 @@ abstract class Product implements ActiveRecordInterface
if ($this->aTaxRule !== null && $this->tax_rule_id !== $this->aTaxRule->getId()) {
$this->aTaxRule = null;
}
if ($this->aTemplate !== null && $this->template_id !== $this->aTemplate->getId()) {
$this->aTemplate = null;
}
} // ensureConsistency
/**
@@ -1117,6 +1172,7 @@ abstract class Product implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects?
$this->aTaxRule = null;
$this->aTemplate = null;
$this->collProductCategories = null;
$this->collFeatureProducts = null;
@@ -1288,6 +1344,13 @@ abstract class Product implements ActiveRecordInterface
$this->setTaxRule($this->aTaxRule);
}
if ($this->aTemplate !== null) {
if ($this->aTemplate->isModified() || $this->aTemplate->isNew()) {
$affectedRows += $this->aTemplate->save($con);
}
$this->setTemplate($this->aTemplate);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
@@ -1608,6 +1671,9 @@ abstract class Product implements ActiveRecordInterface
if ($this->isColumnModified(ProductTableMap::POSITION)) {
$modifiedColumns[':p' . $index++] = 'POSITION';
}
if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) {
$modifiedColumns[':p' . $index++] = 'TEMPLATE_ID';
}
if ($this->isColumnModified(ProductTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1649,6 +1715,9 @@ abstract class Product implements ActiveRecordInterface
case 'POSITION':
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
break;
case 'TEMPLATE_ID':
$stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1742,18 +1811,21 @@ abstract class Product implements ActiveRecordInterface
return $this->getPosition();
break;
case 5:
return $this->getCreatedAt();
return $this->getTemplateId();
break;
case 6:
return $this->getUpdatedAt();
return $this->getCreatedAt();
break;
case 7:
return $this->getVersion();
return $this->getUpdatedAt();
break;
case 8:
return $this->getVersionCreatedAt();
return $this->getVersion();
break;
case 9:
return $this->getVersionCreatedAt();
break;
case 10:
return $this->getVersionCreatedBy();
break;
default:
@@ -1790,11 +1862,12 @@ abstract class Product implements ActiveRecordInterface
$keys[2] => $this->getRef(),
$keys[3] => $this->getVisible(),
$keys[4] => $this->getPosition(),
$keys[5] => $this->getCreatedAt(),
$keys[6] => $this->getUpdatedAt(),
$keys[7] => $this->getVersion(),
$keys[8] => $this->getVersionCreatedAt(),
$keys[9] => $this->getVersionCreatedBy(),
$keys[5] => $this->getTemplateId(),
$keys[6] => $this->getCreatedAt(),
$keys[7] => $this->getUpdatedAt(),
$keys[8] => $this->getVersion(),
$keys[9] => $this->getVersionCreatedAt(),
$keys[10] => $this->getVersionCreatedBy(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1806,6 +1879,9 @@ abstract class Product implements ActiveRecordInterface
if (null !== $this->aTaxRule) {
$result['TaxRule'] = $this->aTaxRule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->aTemplate) {
$result['Template'] = $this->aTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->collProductCategories) {
$result['ProductCategories'] = $this->collProductCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1889,18 +1965,21 @@ abstract class Product implements ActiveRecordInterface
$this->setPosition($value);
break;
case 5:
$this->setCreatedAt($value);
$this->setTemplateId($value);
break;
case 6:
$this->setUpdatedAt($value);
$this->setCreatedAt($value);
break;
case 7:
$this->setVersion($value);
$this->setUpdatedAt($value);
break;
case 8:
$this->setVersionCreatedAt($value);
$this->setVersion($value);
break;
case 9:
$this->setVersionCreatedAt($value);
break;
case 10:
$this->setVersionCreatedBy($value);
break;
} // switch()
@@ -1932,11 +2011,12 @@ abstract class Product implements ActiveRecordInterface
if (array_key_exists($keys[2], $arr)) $this->setRef($arr[$keys[2]]);
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[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setVersion($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedAt($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedBy($arr[$keys[9]]);
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[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]);
}
/**
@@ -1953,6 +2033,7 @@ abstract class Product implements ActiveRecordInterface
if ($this->isColumnModified(ProductTableMap::REF)) $criteria->add(ProductTableMap::REF, $this->ref);
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::TEMPLATE_ID)) $criteria->add(ProductTableMap::TEMPLATE_ID, $this->template_id);
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::VERSION)) $criteria->add(ProductTableMap::VERSION, $this->version);
@@ -2025,6 +2106,7 @@ abstract class Product implements ActiveRecordInterface
$copyObj->setRef($this->getRef());
$copyObj->setVisible($this->getVisible());
$copyObj->setPosition($this->getPosition());
$copyObj->setTemplateId($this->getTemplateId());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion());
@@ -2183,6 +2265,57 @@ abstract class Product implements ActiveRecordInterface
return $this->aTaxRule;
}
/**
* Declares an association between this object and a ChildTemplate object.
*
* @param ChildTemplate $v
* @return \Thelia\Model\Product The current object (for fluent API support)
* @throws PropelException
*/
public function setTemplate(ChildTemplate $v = null)
{
if ($v === null) {
$this->setTemplateId(NULL);
} else {
$this->setTemplateId($v->getId());
}
$this->aTemplate = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildTemplate object, it will not be re-added.
if ($v !== null) {
$v->addProduct($this);
}
return $this;
}
/**
* Get the associated ChildTemplate object
*
* @param ConnectionInterface $con Optional Connection object.
* @return ChildTemplate The associated ChildTemplate object.
* @throws PropelException
*/
public function getTemplate(ConnectionInterface $con = null)
{
if ($this->aTemplate === null && ($this->template_id !== null)) {
$this->aTemplate = ChildTemplateQuery::create()->findPk($this->template_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->aTemplate->addProducts($this);
*/
}
return $this->aTemplate;
}
/**
* Initializes a collection based on the name of a relation.
@@ -5349,6 +5482,7 @@ abstract class Product implements ActiveRecordInterface
$this->ref = null;
$this->visible = null;
$this->position = null;
$this->template_id = null;
$this->created_at = null;
$this->updated_at = null;
$this->version = null;
@@ -5507,6 +5641,7 @@ abstract class Product implements ActiveRecordInterface
}
$this->collProductsRelatedByProductId = null;
$this->aTaxRule = null;
$this->aTemplate = null;
}
/**
@@ -5781,6 +5916,7 @@ abstract class Product implements ActiveRecordInterface
$version->setRef($this->getRef());
$version->setVisible($this->getVisible());
$version->setPosition($this->getPosition());
$version->setTemplateId($this->getTemplateId());
$version->setCreatedAt($this->getCreatedAt());
$version->setUpdatedAt($this->getUpdatedAt());
$version->setVersion($this->getVersion());
@@ -5828,6 +5964,7 @@ abstract class Product implements ActiveRecordInterface
$this->setRef($version->getRef());
$this->setVisible($version->getVisible());
$this->setPosition($version->getPosition());
$this->setTemplateId($version->getTemplateId());
$this->setCreatedAt($version->getCreatedAt());
$this->setUpdatedAt($version->getUpdatedAt());
$this->setVersion($version->getVersion());

View File

@@ -27,6 +27,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery orderByRef($order = Criteria::ASC) Order by the ref 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 orderByTemplateId($order = Criteria::ASC) Order by the template_id 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 orderByVersion($order = Criteria::ASC) Order by the version column
@@ -38,6 +39,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery groupByRef() Group by the ref column
* @method ChildProductQuery groupByVisible() Group by the visible column
* @method ChildProductQuery groupByPosition() Group by the position column
* @method ChildProductQuery groupByTemplateId() Group by the template_id column
* @method ChildProductQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildProductQuery groupByVersion() Group by the version column
@@ -52,6 +54,10 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery rightJoinTaxRule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRule relation
* @method ChildProductQuery innerJoinTaxRule($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRule relation
*
* @method ChildProductQuery leftJoinTemplate($relationAlias = null) Adds a LEFT 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 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 innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
@@ -104,6 +110,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProduct findOneByRef(string $ref) Return the first ChildProduct filtered by the ref 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 findOneByTemplateId(int $template_id) Return the first ChildProduct filtered by the template_id 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 findOneByVersion(int $version) Return the first ChildProduct filtered by the version column
@@ -115,6 +122,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method array findByRef(string $ref) Return ChildProduct objects filtered by the ref 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 findByTemplateId(int $template_id) Return ChildProduct objects filtered by the template_id 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 findByVersion(int $version) Return ChildProduct objects filtered by the version column
@@ -215,7 +223,7 @@ abstract class ProductQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, 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, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -499,6 +507,49 @@ abstract class ProductQuery extends ModelCriteria
return $this->addUsingAlias(ProductTableMap::POSITION, $position, $comparison);
}
/**
* Filter the query on the template_id column
*
* Example usage:
* <code>
* $query->filterByTemplateId(1234); // WHERE template_id = 1234
* $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
* $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
* </code>
*
* @see filterByTemplate()
*
* @param mixed $templateId 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 filterByTemplateId($templateId = null, $comparison = null)
{
if (is_array($templateId)) {
$useMinMax = false;
if (isset($templateId['min'])) {
$this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($templateId['max'])) {
$this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId, $comparison);
}
/**
* Filter the query on the created_at column
*
@@ -773,6 +824,81 @@ abstract class ProductQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'TaxRule', '\Thelia\Model\TaxRuleQuery');
}
/**
* Filter the query by a related \Thelia\Model\Template object
*
* @param \Thelia\Model\Template|ObjectCollection $template 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 filterByTemplate($template, $comparison = null)
{
if ($template instanceof \Thelia\Model\Template) {
return $this
->addUsingAlias(ProductTableMap::TEMPLATE_ID, $template->getId(), $comparison);
} elseif ($template instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(ProductTableMap::TEMPLATE_ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Template 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 joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Template');
// 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, 'Template');
}
return $this;
}
/**
* Use the Template relation Template 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\TemplateQuery A secondary query class using the current class as primary query
*/
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinTemplate($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
}
/**
* Filter the query by a related \Thelia\Model\ProductCategory object
*

View File

@@ -86,6 +86,12 @@ abstract class ProductVersion implements ActiveRecordInterface
*/
protected $position;
/**
* The value for the template_id field.
* @var int
*/
protected $template_id;
/**
* The value for the created_at field.
* @var string
@@ -453,6 +459,17 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this->position;
}
/**
* Get the [template_id] column value.
*
* @return int
*/
public function getTemplateId()
{
return $this->template_id;
}
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -644,6 +661,27 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this;
} // setPosition()
/**
* Set the value of [template_id] column.
*
* @param int $v new value
* @return \Thelia\Model\ProductVersion The current object (for fluent API support)
*/
public function setTemplateId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->template_id !== $v) {
$this->template_id = $v;
$this->modifiedColumns[] = ProductVersionTableMap::TEMPLATE_ID;
}
return $this;
} // setTemplateId()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -809,28 +847,31 @@ abstract class ProductVersion implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductVersionTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
$this->position = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductVersionTableMap::translateFieldName('CreatedAt', 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;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductVersionTableMap::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 ? 9 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified();
@@ -840,7 +881,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 10; // 10 = ProductVersionTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 11; // 11 = ProductVersionTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductVersion object", 0, $e);
@@ -1076,6 +1117,9 @@ abstract class ProductVersion implements ActiveRecordInterface
if ($this->isColumnModified(ProductVersionTableMap::POSITION)) {
$modifiedColumns[':p' . $index++] = 'POSITION';
}
if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) {
$modifiedColumns[':p' . $index++] = 'TEMPLATE_ID';
}
if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1117,6 +1161,9 @@ abstract class ProductVersion implements ActiveRecordInterface
case 'POSITION':
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
break;
case 'TEMPLATE_ID':
$stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1203,18 +1250,21 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this->getPosition();
break;
case 5:
return $this->getCreatedAt();
return $this->getTemplateId();
break;
case 6:
return $this->getUpdatedAt();
return $this->getCreatedAt();
break;
case 7:
return $this->getVersion();
return $this->getUpdatedAt();
break;
case 8:
return $this->getVersionCreatedAt();
return $this->getVersion();
break;
case 9:
return $this->getVersionCreatedAt();
break;
case 10:
return $this->getVersionCreatedBy();
break;
default:
@@ -1251,11 +1301,12 @@ abstract class ProductVersion implements ActiveRecordInterface
$keys[2] => $this->getRef(),
$keys[3] => $this->getVisible(),
$keys[4] => $this->getPosition(),
$keys[5] => $this->getCreatedAt(),
$keys[6] => $this->getUpdatedAt(),
$keys[7] => $this->getVersion(),
$keys[8] => $this->getVersionCreatedAt(),
$keys[9] => $this->getVersionCreatedBy(),
$keys[5] => $this->getTemplateId(),
$keys[6] => $this->getCreatedAt(),
$keys[7] => $this->getUpdatedAt(),
$keys[8] => $this->getVersion(),
$keys[9] => $this->getVersionCreatedAt(),
$keys[10] => $this->getVersionCreatedBy(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1317,18 +1368,21 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->setPosition($value);
break;
case 5:
$this->setCreatedAt($value);
$this->setTemplateId($value);
break;
case 6:
$this->setUpdatedAt($value);
$this->setCreatedAt($value);
break;
case 7:
$this->setVersion($value);
$this->setUpdatedAt($value);
break;
case 8:
$this->setVersionCreatedAt($value);
$this->setVersion($value);
break;
case 9:
$this->setVersionCreatedAt($value);
break;
case 10:
$this->setVersionCreatedBy($value);
break;
} // switch()
@@ -1360,11 +1414,12 @@ abstract class ProductVersion implements ActiveRecordInterface
if (array_key_exists($keys[2], $arr)) $this->setRef($arr[$keys[2]]);
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[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setVersion($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedAt($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedBy($arr[$keys[9]]);
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[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]);
}
/**
@@ -1381,6 +1436,7 @@ abstract class ProductVersion implements ActiveRecordInterface
if ($this->isColumnModified(ProductVersionTableMap::REF)) $criteria->add(ProductVersionTableMap::REF, $this->ref);
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::TEMPLATE_ID)) $criteria->add(ProductVersionTableMap::TEMPLATE_ID, $this->template_id);
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::VERSION)) $criteria->add(ProductVersionTableMap::VERSION, $this->version);
@@ -1461,6 +1517,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$copyObj->setRef($this->getRef());
$copyObj->setVisible($this->getVisible());
$copyObj->setPosition($this->getPosition());
$copyObj->setTemplateId($this->getTemplateId());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion());
@@ -1554,6 +1611,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->ref = null;
$this->visible = null;
$this->position = null;
$this->template_id = null;
$this->created_at = null;
$this->updated_at = null;
$this->version = null;

View File

@@ -26,6 +26,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersionQuery orderByRef($order = Criteria::ASC) Order by the ref 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 orderByTemplateId($order = Criteria::ASC) Order by the template_id 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 orderByVersion($order = Criteria::ASC) Order by the version column
@@ -37,6 +38,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersionQuery groupByRef() Group by the ref column
* @method ChildProductVersionQuery groupByVisible() Group by the visible column
* @method ChildProductVersionQuery groupByPosition() Group by the position column
* @method ChildProductVersionQuery groupByTemplateId() Group by the template_id column
* @method ChildProductVersionQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductVersionQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildProductVersionQuery groupByVersion() Group by the version column
@@ -59,6 +61,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersion findOneByRef(string $ref) Return the first ChildProductVersion filtered by the ref 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 findOneByTemplateId(int $template_id) Return the first ChildProductVersion filtered by the template_id 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 findOneByVersion(int $version) Return the first ChildProductVersion filtered by the version column
@@ -70,6 +73,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method array findByRef(string $ref) Return ChildProductVersion objects filtered by the ref 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 findByTemplateId(int $template_id) Return ChildProductVersion objects filtered by the template_id 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 findByVersion(int $version) Return ChildProductVersion objects filtered by the version column
@@ -163,7 +167,7 @@ abstract class ProductVersionQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, 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, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product_version WHERE ID = :p0 AND VERSION = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -459,6 +463,47 @@ abstract class ProductVersionQuery extends ModelCriteria
return $this->addUsingAlias(ProductVersionTableMap::POSITION, $position, $comparison);
}
/**
* Filter the query on the template_id column
*
* Example usage:
* <code>
* $query->filterByTemplateId(1234); // WHERE template_id = 1234
* $query->filterByTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
* $query->filterByTemplateId(array('min' => 12)); // WHERE template_id > 12
* </code>
*
* @param mixed $templateId 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 filterByTemplateId($templateId = null, $comparison = null)
{
if (is_array($templateId)) {
$useMinMax = false;
if (isset($templateId['min'])) {
$this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($templateId['max'])) {
$this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId, $comparison);
}
/**
* Filter the query on the created_at column
*

View File

@@ -1434,6 +1434,31 @@ abstract class TaxRule implements ActiveRecordInterface
return $this;
}
/**
* 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 getProductsJoinTemplate($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildProductQuery::create(null, $criteria);
$query->joinWith('Template', $joinBehavior);
return $this->getProducts($query, $con);
}
/**
* Clears out the collTaxRuleCountries collection
*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,508 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\TemplateI18n as ChildTemplateI18n;
use Thelia\Model\TemplateI18nQuery as ChildTemplateI18nQuery;
use Thelia\Model\Map\TemplateI18nTableMap;
/**
* Base class that represents a query for the 'template_i18n' table.
*
*
*
* @method ChildTemplateI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildTemplateI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildTemplateI18nQuery orderByName($order = Criteria::ASC) Order by the name column
*
* @method ChildTemplateI18nQuery groupById() Group by the id column
* @method ChildTemplateI18nQuery groupByLocale() Group by the locale column
* @method ChildTemplateI18nQuery groupByName() Group by the name column
*
* @method ChildTemplateI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildTemplateI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildTemplateI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildTemplateI18nQuery leftJoinTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the Template relation
* @method ChildTemplateI18nQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
* @method ChildTemplateI18nQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
*
* @method ChildTemplateI18n findOne(ConnectionInterface $con = null) Return the first ChildTemplateI18n matching the query
* @method ChildTemplateI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTemplateI18n matching the query, or a new ChildTemplateI18n object populated from the query conditions when no match is found
*
* @method ChildTemplateI18n findOneById(int $id) Return the first ChildTemplateI18n filtered by the id column
* @method ChildTemplateI18n findOneByLocale(string $locale) Return the first ChildTemplateI18n filtered by the locale column
* @method ChildTemplateI18n findOneByName(string $name) Return the first ChildTemplateI18n filtered by the name column
*
* @method array findById(int $id) Return ChildTemplateI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildTemplateI18n objects filtered by the locale column
* @method array findByName(string $name) Return ChildTemplateI18n objects filtered by the name column
*
*/
abstract class TemplateI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\TemplateI18nQuery 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\\TemplateI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildTemplateI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildTemplateI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\TemplateI18nQuery) {
return $criteria;
}
$query = new \Thelia\Model\TemplateI18nQuery();
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 ChildTemplateI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = TemplateI18nTableMap::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(TemplateI18nTableMap::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 ChildTemplateI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE, NAME FROM template_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 ChildTemplateI18n();
$obj->hydrate($row);
TemplateI18nTableMap::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 ChildTemplateI18n|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 ChildTemplateI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(TemplateI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(TemplateI18nTableMap::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 ChildTemplateI18nQuery 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(TemplateI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(TemplateI18nTableMap::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 filterByTemplate()
*
* @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 ChildTemplateI18nQuery 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(TemplateI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(TemplateI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(TemplateI18nTableMap::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 ChildTemplateI18nQuery 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(TemplateI18nTableMap::LOCALE, $locale, $comparison);
}
/**
* Filter the query on the name column
*
* Example usage:
* <code>
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
* </code>
*
* @param string $name The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTemplateI18nQuery The current query, for fluid interface
*/
public function filterByName($name = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($name)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $name)) {
$name = str_replace('*', '%', $name);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(TemplateI18nTableMap::NAME, $name, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Template object
*
* @param \Thelia\Model\Template|ObjectCollection $template The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTemplateI18nQuery The current query, for fluid interface
*/
public function filterByTemplate($template, $comparison = null)
{
if ($template instanceof \Thelia\Model\Template) {
return $this
->addUsingAlias(TemplateI18nTableMap::ID, $template->getId(), $comparison);
} elseif ($template instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(TemplateI18nTableMap::ID, $template->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByTemplate() only accepts arguments of type \Thelia\Model\Template or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Template relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildTemplateI18nQuery The current query, for fluid interface
*/
public function joinTemplate($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Template');
// 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, 'Template');
}
return $this;
}
/**
* Use the Template relation Template 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\TemplateQuery A secondary query class using the current class as primary query
*/
public function useTemplateQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinTemplate($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
}
/**
* Exclude object from result
*
* @param ChildTemplateI18n $templateI18n Object to remove from the list of results
*
* @return ChildTemplateI18nQuery The current query, for fluid interface
*/
public function prune($templateI18n = null)
{
if ($templateI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(TemplateI18nTableMap::ID), $templateI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(TemplateI18nTableMap::LOCALE), $templateI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the template_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(TemplateI18nTableMap::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).
TemplateI18nTableMap::clearInstancePool();
TemplateI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildTemplateI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildTemplateI18n 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(TemplateI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(TemplateI18nTableMap::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();
TemplateI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
TemplateI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // TemplateI18nQuery

View File

@@ -0,0 +1,907 @@
<?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\Template as ChildTemplate;
use Thelia\Model\TemplateI18nQuery as ChildTemplateI18nQuery;
use Thelia\Model\TemplateQuery as ChildTemplateQuery;
use Thelia\Model\Map\TemplateTableMap;
/**
* Base class that represents a query for the 'template' table.
*
*
*
* @method ChildTemplateQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildTemplateQuery groupById() Group by the id column
* @method ChildTemplateQuery groupByCreatedAt() Group by the created_at column
* @method ChildTemplateQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildTemplateQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
* @method ChildTemplateQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
* @method ChildTemplateQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
*
* @method ChildTemplateQuery leftJoinFeatureTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureTemplate relation
* @method ChildTemplateQuery rightJoinFeatureTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureTemplate relation
* @method ChildTemplateQuery innerJoinFeatureTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureTemplate relation
*
* @method ChildTemplateQuery leftJoinAttributeTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeTemplate relation
* @method ChildTemplateQuery rightJoinAttributeTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeTemplate relation
* @method ChildTemplateQuery innerJoinAttributeTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeTemplate relation
*
* @method ChildTemplateQuery leftJoinTemplateI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the TemplateI18n relation
* @method ChildTemplateQuery rightJoinTemplateI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TemplateI18n relation
* @method ChildTemplateQuery innerJoinTemplateI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the TemplateI18n relation
*
* @method ChildTemplate findOne(ConnectionInterface $con = null) Return the first ChildTemplate matching the query
* @method ChildTemplate findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTemplate matching the query, or a new ChildTemplate object populated from the query conditions when no match is found
*
* @method ChildTemplate findOneById(int $id) Return the first ChildTemplate filtered by the id column
* @method ChildTemplate findOneByCreatedAt(string $created_at) Return the first ChildTemplate filtered by the created_at column
* @method ChildTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildTemplate filtered by the updated_at column
*
* @method array findById(int $id) Return ChildTemplate objects filtered by the id column
* @method array findByCreatedAt(string $created_at) Return ChildTemplate objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildTemplate objects filtered by the updated_at column
*
*/
abstract class TemplateQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\TemplateQuery 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\\Template', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildTemplateQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildTemplateQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\TemplateQuery) {
return $criteria;
}
$query = new \Thelia\Model\TemplateQuery();
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 ChildTemplate|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = TemplateTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(TemplateTableMap::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 ChildTemplate A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, CREATED_AT, UPDATED_AT FROM template 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 ChildTemplate();
$obj->hydrate($row);
TemplateTableMap::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 ChildTemplate|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 ChildTemplateQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(TemplateTableMap::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 ChildTemplateQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(TemplateTableMap::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 ChildTemplateQuery 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(TemplateTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(TemplateTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(TemplateTableMap::ID, $id, $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 ChildTemplateQuery 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(TemplateTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(TemplateTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(TemplateTableMap::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 ChildTemplateQuery 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(TemplateTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(TemplateTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(TemplateTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Product object
*
* @param \Thelia\Model\Product|ObjectCollection $product the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function filterByProduct($product, $comparison = null)
{
if ($product instanceof \Thelia\Model\Product) {
return $this
->addUsingAlias(TemplateTableMap::ID, $product->getTemplateId(), $comparison);
} elseif ($product instanceof ObjectCollection) {
return $this
->useProductQuery()
->filterByPrimaryKeys($product->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Product relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Product');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Product');
}
return $this;
}
/**
* Use the Product relation Product object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
*/
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinProduct($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
}
/**
* Filter the query by a related \Thelia\Model\FeatureTemplate object
*
* @param \Thelia\Model\FeatureTemplate|ObjectCollection $featureTemplate the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function filterByFeatureTemplate($featureTemplate, $comparison = null)
{
if ($featureTemplate instanceof \Thelia\Model\FeatureTemplate) {
return $this
->addUsingAlias(TemplateTableMap::ID, $featureTemplate->getTemplateId(), $comparison);
} elseif ($featureTemplate instanceof ObjectCollection) {
return $this
->useFeatureTemplateQuery()
->filterByPrimaryKeys($featureTemplate->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByFeatureTemplate() only accepts arguments of type \Thelia\Model\FeatureTemplate or Collection');
}
}
/**
* Adds a JOIN clause to the query using the FeatureTemplate relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function joinFeatureTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('FeatureTemplate');
// 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, 'FeatureTemplate');
}
return $this;
}
/**
* Use the FeatureTemplate relation FeatureTemplate 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\FeatureTemplateQuery A secondary query class using the current class as primary query
*/
public function useFeatureTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinFeatureTemplate($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'FeatureTemplate', '\Thelia\Model\FeatureTemplateQuery');
}
/**
* Filter the query by a related \Thelia\Model\AttributeTemplate object
*
* @param \Thelia\Model\AttributeTemplate|ObjectCollection $attributeTemplate the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function filterByAttributeTemplate($attributeTemplate, $comparison = null)
{
if ($attributeTemplate instanceof \Thelia\Model\AttributeTemplate) {
return $this
->addUsingAlias(TemplateTableMap::ID, $attributeTemplate->getTemplateId(), $comparison);
} elseif ($attributeTemplate instanceof ObjectCollection) {
return $this
->useAttributeTemplateQuery()
->filterByPrimaryKeys($attributeTemplate->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAttributeTemplate() only accepts arguments of type \Thelia\Model\AttributeTemplate or Collection');
}
}
/**
* Adds a JOIN clause to the query using the AttributeTemplate relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function joinAttributeTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AttributeTemplate');
// 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, 'AttributeTemplate');
}
return $this;
}
/**
* Use the AttributeTemplate relation AttributeTemplate 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\AttributeTemplateQuery A secondary query class using the current class as primary query
*/
public function useAttributeTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAttributeTemplate($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AttributeTemplate', '\Thelia\Model\AttributeTemplateQuery');
}
/**
* Filter the query by a related \Thelia\Model\TemplateI18n object
*
* @param \Thelia\Model\TemplateI18n|ObjectCollection $templateI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function filterByTemplateI18n($templateI18n, $comparison = null)
{
if ($templateI18n instanceof \Thelia\Model\TemplateI18n) {
return $this
->addUsingAlias(TemplateTableMap::ID, $templateI18n->getId(), $comparison);
} elseif ($templateI18n instanceof ObjectCollection) {
return $this
->useTemplateI18nQuery()
->filterByPrimaryKeys($templateI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByTemplateI18n() only accepts arguments of type \Thelia\Model\TemplateI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the TemplateI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function joinTemplateI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('TemplateI18n');
// 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, 'TemplateI18n');
}
return $this;
}
/**
* Use the TemplateI18n relation TemplateI18n 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\TemplateI18nQuery A secondary query class using the current class as primary query
*/
public function useTemplateI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinTemplateI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'TemplateI18n', '\Thelia\Model\TemplateI18nQuery');
}
/**
* Filter the query by a related Feature object
* using the feature_template table as cross reference
*
* @param Feature $feature the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function filterByFeature($feature, $comparison = Criteria::EQUAL)
{
return $this
->useFeatureTemplateQuery()
->filterByFeature($feature, $comparison)
->endUse();
}
/**
* Filter the query by a related Attribute object
* using the attribute_template table as cross reference
*
* @param Attribute $attribute the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function filterByAttribute($attribute, $comparison = Criteria::EQUAL)
{
return $this
->useAttributeTemplateQuery()
->filterByAttribute($attribute, $comparison)
->endUse();
}
/**
* Exclude object from result
*
* @param ChildTemplate $template Object to remove from the list of results
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function prune($template = null)
{
if ($template) {
$this->addUsingAlias(TemplateTableMap::ID, $template->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the template 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(TemplateTableMap::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).
TemplateTableMap::clearInstancePool();
TemplateTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildTemplate or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildTemplate 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(TemplateTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(TemplateTableMap::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();
TemplateTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
TemplateTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// i18n behavior
/**
* Adds a JOIN clause to the query using the i18n relation
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'TemplateI18n';
return $this
->joinTemplateI18n($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 ChildTemplateQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('TemplateI18n');
$this->with['TemplateI18n']->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 ChildTemplateI18nQuery 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 : 'TemplateI18n', '\Thelia\Model\TemplateI18nQuery');
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(TemplateTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(TemplateTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(TemplateTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(TemplateTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(TemplateTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildTemplateQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(TemplateTableMap::CREATED_AT);
}
} // TemplateQuery

View File

@@ -205,11 +205,42 @@ class Customer extends BaseCustomer implements UserInterface
return array(new Role('CUSTOMER'));
}
/**
* {@inheritDoc}
*/
public function getToken() {
return $this->getRememberMeToken();
}
/**
* {@inheritDoc}
*/
public function setToken($token) {
$this->setRememberMeToken($token)->save();
}
/**
* {@inheritDoc}
*/
public function getSerial() {
return $this->getRememberMeSerial();
}
/**
* {@inheritDoc}
*/
public function setSerial($serial) {
$this->setRememberMeSerial($serial)->save();
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
// Set the serial number (for auto-login)
$this->setRememberMeSerial(uniqid());
$this->setRef($this->generateRef());
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECUSTOMER, new CustomerEvent($this));

View File

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

View File

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

View File

@@ -57,7 +57,7 @@ class AdminTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 9;
const NUM_COLUMNS = 11;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class AdminTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 9;
const NUM_HYDRATE_COLUMNS = 11;
/**
* the column name for the ID field
@@ -104,6 +104,16 @@ class AdminTableMap extends TableMap
*/
const SALT = 'admin.SALT';
/**
* the column name for the REMEMBER_ME_TOKEN field
*/
const REMEMBER_ME_TOKEN = 'admin.REMEMBER_ME_TOKEN';
/**
* the column name for the REMEMBER_ME_SERIAL field
*/
const REMEMBER_ME_SERIAL = 'admin.REMEMBER_ME_SERIAL';
/**
* the column name for the CREATED_AT field
*/
@@ -126,12 +136,12 @@ class AdminTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
self::TYPE_PHPNAME => array('Id', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(AdminTableMap::ID, AdminTableMap::FIRSTNAME, AdminTableMap::LASTNAME, AdminTableMap::LOGIN, AdminTableMap::PASSWORD, AdminTableMap::ALGO, AdminTableMap::SALT, AdminTableMap::REMEMBER_ME_TOKEN, AdminTableMap::REMEMBER_ME_SERIAL, AdminTableMap::CREATED_AT, AdminTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -141,12 +151,12 @@ class AdminTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Firstname' => 1, 'Lastname' => 2, 'Login' => 3, 'Password' => 4, 'Algo' => 5, 'Salt' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::FIRSTNAME => 1, AdminTableMap::LASTNAME => 2, AdminTableMap::LOGIN => 3, AdminTableMap::PASSWORD => 4, AdminTableMap::ALGO => 5, AdminTableMap::SALT => 6, AdminTableMap::CREATED_AT => 7, AdminTableMap::UPDATED_AT => 8, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'FIRSTNAME' => 1, 'LASTNAME' => 2, 'LOGIN' => 3, 'PASSWORD' => 4, 'ALGO' => 5, 'SALT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
self::TYPE_FIELDNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'created_at' => 7, 'updated_at' => 8, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
self::TYPE_PHPNAME => array('Id' => 0, 'Firstname' => 1, 'Lastname' => 2, 'Login' => 3, 'Password' => 4, 'Algo' => 5, 'Salt' => 6, 'RememberMeToken' => 7, 'RememberMeSerial' => 8, 'CreatedAt' => 9, 'UpdatedAt' => 10, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'rememberMeToken' => 7, 'rememberMeSerial' => 8, 'createdAt' => 9, 'updatedAt' => 10, ),
self::TYPE_COLNAME => array(AdminTableMap::ID => 0, AdminTableMap::FIRSTNAME => 1, AdminTableMap::LASTNAME => 2, AdminTableMap::LOGIN => 3, AdminTableMap::PASSWORD => 4, AdminTableMap::ALGO => 5, AdminTableMap::SALT => 6, AdminTableMap::REMEMBER_ME_TOKEN => 7, AdminTableMap::REMEMBER_ME_SERIAL => 8, AdminTableMap::CREATED_AT => 9, AdminTableMap::UPDATED_AT => 10, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'FIRSTNAME' => 1, 'LASTNAME' => 2, 'LOGIN' => 3, 'PASSWORD' => 4, 'ALGO' => 5, 'SALT' => 6, 'REMEMBER_ME_TOKEN' => 7, 'REMEMBER_ME_SERIAL' => 8, 'CREATED_AT' => 9, 'UPDATED_AT' => 10, ),
self::TYPE_FIELDNAME => array('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'remember_me_token' => 7, 'remember_me_serial' => 8, 'created_at' => 9, 'updated_at' => 10, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -172,6 +182,8 @@ class AdminTableMap extends TableMap
$this->addColumn('PASSWORD', 'Password', 'VARCHAR', true, 128, null);
$this->addColumn('ALGO', 'Algo', 'VARCHAR', false, 128, null);
$this->addColumn('SALT', 'Salt', 'VARCHAR', false, 128, null);
$this->addColumn('REMEMBER_ME_TOKEN', 'RememberMeToken', 'VARCHAR', false, 255, null);
$this->addColumn('REMEMBER_ME_SERIAL', 'RememberMeSerial', 'VARCHAR', false, 255, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -352,6 +364,8 @@ class AdminTableMap extends TableMap
$criteria->addSelectColumn(AdminTableMap::PASSWORD);
$criteria->addSelectColumn(AdminTableMap::ALGO);
$criteria->addSelectColumn(AdminTableMap::SALT);
$criteria->addSelectColumn(AdminTableMap::REMEMBER_ME_TOKEN);
$criteria->addSelectColumn(AdminTableMap::REMEMBER_ME_SERIAL);
$criteria->addSelectColumn(AdminTableMap::CREATED_AT);
$criteria->addSelectColumn(AdminTableMap::UPDATED_AT);
} else {
@@ -362,6 +376,8 @@ class AdminTableMap extends TableMap
$criteria->addSelectColumn($alias . '.PASSWORD');
$criteria->addSelectColumn($alias . '.ALGO');
$criteria->addSelectColumn($alias . '.SALT');
$criteria->addSelectColumn($alias . '.REMEMBER_ME_TOKEN');
$criteria->addSelectColumn($alias . '.REMEMBER_ME_SERIAL');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}

View File

@@ -162,9 +162,9 @@ class AttributeTableMap extends TableMap
{
$this->addRelation('AttributeAv', '\\Thelia\\Model\\AttributeAv', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeAvs');
$this->addRelation('AttributeCombination', '\\Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeCombinations');
$this->addRelation('AttributeCategory', '\\Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategories');
$this->addRelation('AttributeTemplate', '\\Thelia\\Model\\AttributeTemplate', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeTemplates');
$this->addRelation('AttributeI18n', '\\Thelia\\Model\\AttributeI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'AttributeI18ns');
$this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Categories');
$this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_MANY, array(), null, null, 'Templates');
} // buildRelations()
/**
@@ -189,7 +189,7 @@ class AttributeTableMap extends TableMap
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeAvTableMap::clearInstancePool();
AttributeCombinationTableMap::clearInstancePool();
AttributeCategoryTableMap::clearInstancePool();
AttributeTemplateTableMap::clearInstancePool();
AttributeI18nTableMap::clearInstancePool();
}

View File

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

View File

@@ -191,16 +191,12 @@ class CategoryTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
$this->addRelation('FeatureCategory', '\\Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'FeatureCategories');
$this->addRelation('AttributeCategory', '\\Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategories');
$this->addRelation('CategoryImage', '\\Thelia\\Model\\CategoryImage', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryImages');
$this->addRelation('CategoryDocument', '\\Thelia\\Model\\CategoryDocument', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryDocuments');
$this->addRelation('CategoryAssociatedContent', '\\Thelia\\Model\\CategoryAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryAssociatedContents');
$this->addRelation('CategoryI18n', '\\Thelia\\Model\\CategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryI18ns');
$this->addRelation('CategoryVersion', '\\Thelia\\Model\\CategoryVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryVersions');
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Products');
$this->addRelation('Feature', '\\Thelia\\Model\\Feature', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Features');
$this->addRelation('Attribute', '\\Thelia\\Model\\Attribute', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Attributes');
} // buildRelations()
/**
@@ -225,8 +221,6 @@ class CategoryTableMap extends TableMap
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ProductCategoryTableMap::clearInstancePool();
FeatureCategoryTableMap::clearInstancePool();
AttributeCategoryTableMap::clearInstancePool();
CategoryImageTableMap::clearInstancePool();
CategoryDocumentTableMap::clearInstancePool();
CategoryAssociatedContentTableMap::clearInstancePool();

View File

@@ -57,7 +57,7 @@ class CustomerTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 14;
const NUM_COLUMNS = 16;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class CustomerTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 14;
const NUM_HYDRATE_COLUMNS = 16;
/**
* the column name for the ID field
@@ -129,6 +129,16 @@ class CustomerTableMap extends TableMap
*/
const DISCOUNT = 'customer.DISCOUNT';
/**
* the column name for the REMEMBER_ME_TOKEN field
*/
const REMEMBER_ME_TOKEN = 'customer.REMEMBER_ME_TOKEN';
/**
* the column name for the REMEMBER_ME_SERIAL field
*/
const REMEMBER_ME_SERIAL = 'customer.REMEMBER_ME_SERIAL';
/**
* the column name for the CREATED_AT field
*/
@@ -151,12 +161,12 @@ class CustomerTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Ref', 'TitleId', 'Firstname', 'Lastname', 'Email', 'Password', 'Algo', 'Reseller', 'Lang', 'Sponsor', 'Discount', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'titleId', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(CustomerTableMap::ID, CustomerTableMap::REF, CustomerTableMap::TITLE_ID, CustomerTableMap::FIRSTNAME, CustomerTableMap::LASTNAME, CustomerTableMap::EMAIL, CustomerTableMap::PASSWORD, CustomerTableMap::ALGO, CustomerTableMap::RESELLER, CustomerTableMap::LANG, CustomerTableMap::SPONSOR, CustomerTableMap::DISCOUNT, CustomerTableMap::CREATED_AT, CustomerTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'REF', 'TITLE_ID', 'FIRSTNAME', 'LASTNAME', 'EMAIL', 'PASSWORD', 'ALGO', 'RESELLER', 'LANG', 'SPONSOR', 'DISCOUNT', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'ref', 'title_id', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
self::TYPE_PHPNAME => array('Id', 'Ref', 'TitleId', 'Firstname', 'Lastname', 'Email', 'Password', 'Algo', 'Reseller', 'Lang', 'Sponsor', 'Discount', 'RememberMeToken', 'RememberMeSerial', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'titleId', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'rememberMeToken', 'rememberMeSerial', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(CustomerTableMap::ID, CustomerTableMap::REF, CustomerTableMap::TITLE_ID, CustomerTableMap::FIRSTNAME, CustomerTableMap::LASTNAME, CustomerTableMap::EMAIL, CustomerTableMap::PASSWORD, CustomerTableMap::ALGO, CustomerTableMap::RESELLER, CustomerTableMap::LANG, CustomerTableMap::SPONSOR, CustomerTableMap::DISCOUNT, CustomerTableMap::REMEMBER_ME_TOKEN, CustomerTableMap::REMEMBER_ME_SERIAL, CustomerTableMap::CREATED_AT, CustomerTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'REF', 'TITLE_ID', 'FIRSTNAME', 'LASTNAME', 'EMAIL', 'PASSWORD', 'ALGO', 'RESELLER', 'LANG', 'SPONSOR', 'DISCOUNT', 'REMEMBER_ME_TOKEN', 'REMEMBER_ME_SERIAL', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'ref', 'title_id', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'remember_me_token', 'remember_me_serial', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
@@ -166,12 +176,12 @@ class CustomerTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'TitleId' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Email' => 5, 'Password' => 6, 'Algo' => 7, 'Reseller' => 8, 'Lang' => 9, 'Sponsor' => 10, 'Discount' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'titleId' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'createdAt' => 12, 'updatedAt' => 13, ),
self::TYPE_COLNAME => array(CustomerTableMap::ID => 0, CustomerTableMap::REF => 1, CustomerTableMap::TITLE_ID => 2, CustomerTableMap::FIRSTNAME => 3, CustomerTableMap::LASTNAME => 4, CustomerTableMap::EMAIL => 5, CustomerTableMap::PASSWORD => 6, CustomerTableMap::ALGO => 7, CustomerTableMap::RESELLER => 8, CustomerTableMap::LANG => 9, CustomerTableMap::SPONSOR => 10, CustomerTableMap::DISCOUNT => 11, CustomerTableMap::CREATED_AT => 12, CustomerTableMap::UPDATED_AT => 13, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'TITLE_ID' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'EMAIL' => 5, 'PASSWORD' => 6, 'ALGO' => 7, 'RESELLER' => 8, 'LANG' => 9, 'SPONSOR' => 10, 'DISCOUNT' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, ),
self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'title_id' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'created_at' => 12, 'updated_at' => 13, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'TitleId' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Email' => 5, 'Password' => 6, 'Algo' => 7, 'Reseller' => 8, 'Lang' => 9, 'Sponsor' => 10, 'Discount' => 11, 'RememberMeToken' => 12, 'RememberMeSerial' => 13, 'CreatedAt' => 14, 'UpdatedAt' => 15, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'titleId' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'rememberMeToken' => 12, 'rememberMeSerial' => 13, 'createdAt' => 14, 'updatedAt' => 15, ),
self::TYPE_COLNAME => array(CustomerTableMap::ID => 0, CustomerTableMap::REF => 1, CustomerTableMap::TITLE_ID => 2, CustomerTableMap::FIRSTNAME => 3, CustomerTableMap::LASTNAME => 4, CustomerTableMap::EMAIL => 5, CustomerTableMap::PASSWORD => 6, CustomerTableMap::ALGO => 7, CustomerTableMap::RESELLER => 8, CustomerTableMap::LANG => 9, CustomerTableMap::SPONSOR => 10, CustomerTableMap::DISCOUNT => 11, CustomerTableMap::REMEMBER_ME_TOKEN => 12, CustomerTableMap::REMEMBER_ME_SERIAL => 13, CustomerTableMap::CREATED_AT => 14, CustomerTableMap::UPDATED_AT => 15, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'TITLE_ID' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'EMAIL' => 5, 'PASSWORD' => 6, 'ALGO' => 7, 'RESELLER' => 8, 'LANG' => 9, 'SPONSOR' => 10, 'DISCOUNT' => 11, 'REMEMBER_ME_TOKEN' => 12, 'REMEMBER_ME_SERIAL' => 13, 'CREATED_AT' => 14, 'UPDATED_AT' => 15, ),
self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'title_id' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'remember_me_token' => 12, 'remember_me_serial' => 13, 'created_at' => 14, 'updated_at' => 15, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
@@ -202,6 +212,8 @@ class CustomerTableMap extends TableMap
$this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null);
$this->addColumn('SPONSOR', 'Sponsor', 'VARCHAR', false, 50, null);
$this->addColumn('DISCOUNT', 'Discount', 'FLOAT', false, null, null);
$this->addColumn('REMEMBER_ME_TOKEN', 'RememberMeToken', 'VARCHAR', false, 255, null);
$this->addColumn('REMEMBER_ME_SERIAL', 'RememberMeSerial', 'VARCHAR', false, 255, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -390,6 +402,8 @@ class CustomerTableMap extends TableMap
$criteria->addSelectColumn(CustomerTableMap::LANG);
$criteria->addSelectColumn(CustomerTableMap::SPONSOR);
$criteria->addSelectColumn(CustomerTableMap::DISCOUNT);
$criteria->addSelectColumn(CustomerTableMap::REMEMBER_ME_TOKEN);
$criteria->addSelectColumn(CustomerTableMap::REMEMBER_ME_SERIAL);
$criteria->addSelectColumn(CustomerTableMap::CREATED_AT);
$criteria->addSelectColumn(CustomerTableMap::UPDATED_AT);
} else {
@@ -405,6 +419,8 @@ class CustomerTableMap extends TableMap
$criteria->addSelectColumn($alias . '.LANG');
$criteria->addSelectColumn($alias . '.SPONSOR');
$criteria->addSelectColumn($alias . '.DISCOUNT');
$criteria->addSelectColumn($alias . '.REMEMBER_ME_TOKEN');
$criteria->addSelectColumn($alias . '.REMEMBER_ME_SERIAL');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}

View File

@@ -168,9 +168,9 @@ class FeatureTableMap extends TableMap
{
$this->addRelation('FeatureAv', '\\Thelia\\Model\\FeatureAv', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureAvs');
$this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts');
$this->addRelation('FeatureCategory', '\\Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureCategories');
$this->addRelation('FeatureTemplate', '\\Thelia\\Model\\FeatureTemplate', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureTemplates');
$this->addRelation('FeatureI18n', '\\Thelia\\Model\\FeatureI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'FeatureI18ns');
$this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Categories');
$this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_MANY, array(), null, null, 'Templates');
} // buildRelations()
/**
@@ -195,7 +195,7 @@ class FeatureTableMap extends TableMap
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
FeatureAvTableMap::clearInstancePool();
FeatureProductTableMap::clearInstancePool();
FeatureCategoryTableMap::clearInstancePool();
FeatureTemplateTableMap::clearInstancePool();
FeatureI18nTableMap::clearInstancePool();
}

View File

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

View File

@@ -57,7 +57,7 @@ class ProductTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 10;
const NUM_COLUMNS = 11;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ProductTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 10;
const NUM_HYDRATE_COLUMNS = 11;
/**
* the column name for the ID field
@@ -94,6 +94,11 @@ class ProductTableMap extends TableMap
*/
const POSITION = 'product.POSITION';
/**
* the column name for the TEMPLATE_ID field
*/
const TEMPLATE_ID = 'product.TEMPLATE_ID';
/**
* the column name for the CREATED_AT field
*/
@@ -140,12 +145,12 @@ class ProductTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
self::TYPE_COLNAME => array(ProductTableMap::ID, ProductTableMap::TAX_RULE_ID, ProductTableMap::REF, ProductTableMap::VISIBLE, ProductTableMap::POSITION, 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', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', '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, )
self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', '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_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_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_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, )
);
/**
@@ -155,12 +160,12 @@ class ProductTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, 'Version' => 7, 'VersionCreatedAt' => 8, 'VersionCreatedBy' => 9, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, 'version' => 7, 'versionCreatedAt' => 8, 'versionCreatedBy' => 9, ),
self::TYPE_COLNAME => array(ProductTableMap::ID => 0, ProductTableMap::TAX_RULE_ID => 1, ProductTableMap::REF => 2, ProductTableMap::VISIBLE => 3, ProductTableMap::POSITION => 4, ProductTableMap::CREATED_AT => 5, ProductTableMap::UPDATED_AT => 6, ProductTableMap::VERSION => 7, ProductTableMap::VERSION_CREATED_AT => 8, ProductTableMap::VERSION_CREATED_BY => 9, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, 'VERSION' => 7, 'VERSION_CREATED_AT' => 8, 'VERSION_CREATED_BY' => 9, ),
self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, 'version' => 7, 'version_created_at' => 8, 'version_created_by' => 9, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
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_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_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_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_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_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -184,6 +189,7 @@ class ProductTableMap extends TableMap
$this->addColumn('REF', 'Ref', 'VARCHAR', true, 255, null);
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
$this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
@@ -197,6 +203,7 @@ class ProductTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'SET NULL', 'RESTRICT');
$this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), null, null);
$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('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductSaleElementss');
@@ -388,6 +395,7 @@ class ProductTableMap extends TableMap
$criteria->addSelectColumn(ProductTableMap::REF);
$criteria->addSelectColumn(ProductTableMap::VISIBLE);
$criteria->addSelectColumn(ProductTableMap::POSITION);
$criteria->addSelectColumn(ProductTableMap::TEMPLATE_ID);
$criteria->addSelectColumn(ProductTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductTableMap::UPDATED_AT);
$criteria->addSelectColumn(ProductTableMap::VERSION);
@@ -399,6 +407,7 @@ class ProductTableMap extends TableMap
$criteria->addSelectColumn($alias . '.REF');
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION');

View File

@@ -57,7 +57,7 @@ class ProductVersionTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 10;
const NUM_COLUMNS = 11;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ProductVersionTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 10;
const NUM_HYDRATE_COLUMNS = 11;
/**
* the column name for the ID field
@@ -94,6 +94,11 @@ class ProductVersionTableMap extends TableMap
*/
const POSITION = 'product_version.POSITION';
/**
* the column name for the TEMPLATE_ID field
*/
const TEMPLATE_ID = 'product_version.TEMPLATE_ID';
/**
* the column name for the CREATED_AT field
*/
@@ -131,12 +136,12 @@ class ProductVersionTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
self::TYPE_COLNAME => array(ProductVersionTableMap::ID, ProductVersionTableMap::TAX_RULE_ID, ProductVersionTableMap::REF, ProductVersionTableMap::VISIBLE, ProductVersionTableMap::POSITION, 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', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', '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, )
self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', '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_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_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_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, )
);
/**
@@ -146,12 +151,12 @@ class ProductVersionTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, 'Version' => 7, 'VersionCreatedAt' => 8, 'VersionCreatedBy' => 9, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, 'version' => 7, 'versionCreatedAt' => 8, 'versionCreatedBy' => 9, ),
self::TYPE_COLNAME => array(ProductVersionTableMap::ID => 0, ProductVersionTableMap::TAX_RULE_ID => 1, ProductVersionTableMap::REF => 2, ProductVersionTableMap::VISIBLE => 3, ProductVersionTableMap::POSITION => 4, ProductVersionTableMap::CREATED_AT => 5, ProductVersionTableMap::UPDATED_AT => 6, ProductVersionTableMap::VERSION => 7, ProductVersionTableMap::VERSION_CREATED_AT => 8, ProductVersionTableMap::VERSION_CREATED_BY => 9, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, 'VERSION' => 7, 'VERSION_CREATED_AT' => 8, 'VERSION_CREATED_BY' => 9, ),
self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, 'version' => 7, 'version_created_at' => 8, 'version_created_by' => 9, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
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_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_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_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_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_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -175,6 +180,7 @@ class ProductVersionTableMap extends TableMap
$this->addColumn('REF', 'Ref', 'VARCHAR', true, 255, null);
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
$this->addColumn('TEMPLATE_ID', 'TemplateId', 'INTEGER', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
@@ -257,11 +263,11 @@ class ProductVersionTableMap extends TableMap
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 ? 7 + $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 ? 8 + $offset : static::translateFieldName('Version', 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 ? 7 + $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 ? 8 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
}
/**
@@ -382,6 +388,7 @@ class ProductVersionTableMap extends TableMap
$criteria->addSelectColumn(ProductVersionTableMap::REF);
$criteria->addSelectColumn(ProductVersionTableMap::VISIBLE);
$criteria->addSelectColumn(ProductVersionTableMap::POSITION);
$criteria->addSelectColumn(ProductVersionTableMap::TEMPLATE_ID);
$criteria->addSelectColumn(ProductVersionTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductVersionTableMap::UPDATED_AT);
$criteria->addSelectColumn(ProductVersionTableMap::VERSION);
@@ -393,6 +400,7 @@ class ProductVersionTableMap extends TableMap
$criteria->addSelectColumn($alias . '.REF');
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION');

View File

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

View File

@@ -0,0 +1,455 @@
<?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\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\Template;
use Thelia\Model\TemplateQuery;
/**
* This class defines the structure of the 'template' 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 TemplateTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.TemplateTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'template';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\Template';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.Template';
/**
* The total number of columns
*/
const NUM_COLUMNS = 3;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 3;
/**
* the column name for the ID field
*/
const ID = 'template.ID';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'template.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'template.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', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(TemplateTableMap::ID, TemplateTableMap::CREATED_AT, TemplateTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'CreatedAt' => 1, 'UpdatedAt' => 2, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'createdAt' => 1, 'updatedAt' => 2, ),
self::TYPE_COLNAME => array(TemplateTableMap::ID => 0, TemplateTableMap::CREATED_AT => 1, TemplateTableMap::UPDATED_AT => 2, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CREATED_AT' => 1, 'UPDATED_AT' => 2, ),
self::TYPE_FIELDNAME => array('id' => 0, 'created_at' => 1, 'updated_at' => 2, ),
self::TYPE_NUM => array(0, 1, 2, )
);
/**
* Initialize the table attributes and columns
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('template');
$this->setPhpName('Template');
$this->setClassName('\\Thelia\\Model\\Template');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), null, null, 'Products');
$this->addRelation('FeatureTemplate', '\\Thelia\\Model\\FeatureTemplate', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), null, null, 'FeatureTemplates');
$this->addRelation('AttributeTemplate', '\\Thelia\\Model\\AttributeTemplate', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), null, null, 'AttributeTemplates');
$this->addRelation('TemplateI18n', '\\Thelia\\Model\\TemplateI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'TemplateI18ns');
$this->addRelation('Feature', '\\Thelia\\Model\\Feature', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Features');
$this->addRelation('Attribute', '\\Thelia\\Model\\Attribute', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Attributes');
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'name', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* Method to invalidate the instance pool of all tables related to template * 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.
TemplateI18nTableMap::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 ? TemplateTableMap::CLASS_DEFAULT : TemplateTableMap::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 (Template object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = TemplateTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = TemplateTableMap::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 + TemplateTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = TemplateTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
TemplateTableMap::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 = TemplateTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = TemplateTableMap::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;
TemplateTableMap::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(TemplateTableMap::ID);
$criteria->addSelectColumn(TemplateTableMap::CREATED_AT);
$criteria->addSelectColumn(TemplateTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.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(TemplateTableMap::DATABASE_NAME)->getTable(TemplateTableMap::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this tableMap class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(TemplateTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(TemplateTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new TemplateTableMap());
}
}
/**
* Performs a DELETE on the database, given a Template or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Template 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(TemplateTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\Template) { // 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(TemplateTableMap::DATABASE_NAME);
$criteria->add(TemplateTableMap::ID, (array) $values, Criteria::IN);
}
$query = TemplateQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { TemplateTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { TemplateTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
}
/**
* Deletes all rows from the template 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 TemplateQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a Template or Criteria object.
*
* @param mixed $criteria Criteria or Template 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(TemplateTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from Template object
}
if ($criteria->containsKey(TemplateTableMap::ID) && $criteria->keyContainsValue(TemplateTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.TemplateTableMap::ID.')');
}
// Set the correct dbName
$query = TemplateQuery::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;
}
} // TemplateTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
TemplateTableMap::buildTableMap();

View File

@@ -0,0 +1,68 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\Template as BaseTemplate;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Event\TemplateEvent;
use Thelia\Core\Event\TheliaEvents;
class Template extends BaseTemplate
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_CREATETEMPLATE, new TemplateEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_CREATETEMPLATE, new TemplateEvent($this));
}
/**
* {@inheritDoc}
*/
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATETEMPLATE, new TemplateEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_UPDATETEMPLATE, new TemplateEvent($this));
}
/**
* {@inheritDoc}
*/
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_DELETETEMPLATE, new TemplateEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_DELETETEMPLATE, new TemplateEvent($this));
}
}

View File

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

View File

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

View File

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

View File

@@ -27,12 +27,12 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
class Redirect
{
public static function exec($url, $status = 302)
{
$response = new RedirectResponse($url, $status);
$response->send();
exit;
}
}

View File

@@ -240,6 +240,28 @@ try {
}
}
$template = new Thelia\Model\Template();
setI18n($faker, $template, array("Name" => 20));
$template->save();
foreach($attributeList as $attributeId => $attributeAvId) {
$at = new Thelia\Model\AttributeTemplate();
$at
->setTemplate($template)
->setAttributeId($attributeId)
->save();
}
foreach($featureList as $featureId => $featureAvId) {
$ft = new Thelia\Model\FeatureTemplate();
$ft
->setTemplate($template)
->setFeatureId($featureId)
->save();
}
//folders and contents
$contentIdList = array();
for($i=0; $i<4; $i++) {
@@ -296,12 +318,12 @@ try {
$subcategory = createCategory($faker, $category->getId(), $j, $categoryIdList, $contentIdList);
for($k=0; $k<rand(0, 5); $k++) {
createProduct($faker, $subcategory, $k, $productIdList);
createProduct($faker, $subcategory, $k, $template, $productIdList);
}
}
for($k=1; $k<rand(1, 6); $k++) {
createProduct($faker, $category, $k, $productIdList);
createProduct($faker, $category, $k, $template, $productIdList);
}
}
@@ -416,7 +438,7 @@ try {
$con->rollBack();
}
function createProduct($faker, $category, $position, &$productIdList)
function createProduct($faker, $category, $position, $template, &$productIdList)
{
$product = new Thelia\Model\Product();
$product->setRef($category->getId() . '_' . $position . '_' . $faker->randomNumber(8));
@@ -424,6 +446,8 @@ function createProduct($faker, $category, $position, &$productIdList)
$product->setVisible(rand(1, 10)>7 ? 0 : 1);
$product->setPosition($position);
$product->setTaxRuleId(1);
$product->setTemplate($template);
setI18n($faker, $product);
$product->save();
@@ -521,18 +545,18 @@ function generate_image($image, $position, $typeobj, $id) {
$image->save($image_file);
}
function setI18n($faker, &$object)
function setI18n($faker, &$object, $fields = array('Title' => 20, 'Description' => 50) )
{
$localeList = array('fr_FR', 'en_EN');
$title = $faker->text(20);
$description = $faker->text(50);
$localeList = $localeList = array('fr_FR', 'en_US', 'es_ES', 'it_IT');
foreach($localeList as $locale) {
$object->setLocale($locale);
$object->setTitle($locale . ' : ' . $title);
$object->setDescription($locale . ' : ' . $description);
foreach($fields as $name => $length) {
$func = "set".ucfirst(strtolower($name));
$object->$func($locale . ' : ' . $faker->text($length));
}
}
}
/**

View File

@@ -156,18 +156,18 @@ try {
$con->rollBack();
}
function setI18n($faker, &$object)
function setI18n($faker, &$object, $fields = array('Title' => 20, 'Description' => 50) )
{
$localeList = array('fr_FR', 'en_EN', 'es_ES', 'it_IT');
$title = $faker->text(20);
$description = $faker->text(50);
$localeList = array('fr_FR', 'en_US', 'es_ES', 'it_IT');
foreach($localeList as $locale) {
$object->setLocale($locale);
$object->setTitle($locale . ' : ' . $title);
$object->setDescription($locale . ' : ' . $description);
foreach($fields as $name => $length) {
$func = "set$name";
$object->$func($locale . ' : ' . $faker->text($length));
}
}
}

View File

@@ -17,8 +17,14 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
('image_cache_dir_from_web_root', 'cache/images', 0, 0, NOW(), NOW()),
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()),
('page_not_found_view', '404.html', 0, 0, NOW(), NOW()),
('use_tax_free_amounts', 0, 1, 0, NOW(), NOW()),
('process_assets', '1', 0, 0, NOW(), NOW());
('use_tax_free_amounts', 0, 0, 0, NOW(), NOW()),
('process_assets', '1', 0, 0, NOW(), NOW()),
('thelia_admin_remember_me_cookie_name', 'tarmcn', 0, 0, NOW(), NOW()),
('thelia_admin_remember_me_cookie_expiration', 2592000, 0, 0, NOW(), NOW()),
('thelia_customer_remember_me_cookie_name', 'tcrmcn', 0, 0, NOW(), NOW()),
('thelia_customer_remember_me_cookie_expiration', 31536000, 0, 0, NOW(), NOW()),
('session_config.handlers', 'Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler', 0, 0, NOW(), NOW())
;
INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES

View File

@@ -36,6 +36,7 @@ CREATE TABLE `product`
`ref` VARCHAR(255) NOT NULL,
`visible` TINYINT DEFAULT 0 NOT NULL,
`position` INTEGER NOT NULL,
`template_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
`version` INTEGER DEFAULT 0,
@@ -44,11 +45,15 @@ CREATE TABLE `product`
PRIMARY KEY (`id`),
UNIQUE INDEX `ref_UNIQUE` (`ref`),
INDEX `idx_product_tax_rule_id` (`tax_rule_id`),
INDEX `fk_product_template1_idx` (`template_id`),
CONSTRAINT `fk_product_tax_rule_id`
FOREIGN KEY (`tax_rule_id`)
REFERENCES `tax_rule` (`id`)
ON UPDATE RESTRICT
ON DELETE SET NULL
ON DELETE SET NULL,
CONSTRAINT `fk_product_template1`
FOREIGN KEY (`template_id`)
REFERENCES `template` (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
@@ -243,31 +248,29 @@ CREATE TABLE `feature_product`
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- feature_category
-- feature_template
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `feature_category`;
DROP TABLE IF EXISTS `feature_template`;
CREATE TABLE `feature_category`
CREATE TABLE `feature_template`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`feature_id` INTEGER NOT NULL,
`category_id` INTEGER NOT NULL,
`template_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_feature_category_category_id` (`category_id`),
INDEX `idx_feature_category_feature_id` (`feature_id`),
CONSTRAINT `fk_feature_category_category_id`
FOREIGN KEY (`category_id`)
REFERENCES `category` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_feature_category_feature_id`
INDEX `idx_feature_template_id` (`feature_id`),
INDEX `fk_feature_template_idx` (`template_id`),
CONSTRAINT `fk_feature_template_id`
FOREIGN KEY (`feature_id`)
REFERENCES `feature` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
ON DELETE CASCADE,
CONSTRAINT `fk_feature_template`
FOREIGN KEY (`template_id`)
REFERENCES `template` (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
@@ -367,31 +370,29 @@ CREATE TABLE `product_sale_elements`
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- attribute_category
-- attribute_template
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `attribute_category`;
DROP TABLE IF EXISTS `attribute_template`;
CREATE TABLE `attribute_category`
CREATE TABLE `attribute_template`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`category_id` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`template_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_attribute_category_category_id` (`category_id`),
INDEX `idx_attribute_category_attribute_id` (`attribute_id`),
CONSTRAINT `fk_attribute_category_category_id`
FOREIGN KEY (`category_id`)
REFERENCES `category` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_attribute_category_attribute_id`
INDEX `idx_attribute_template_id` (`attribute_id`),
INDEX `fk_attribute_template_idx` (`template_id`),
CONSTRAINT `fk_attribute_template_id`
FOREIGN KEY (`attribute_id`)
REFERENCES `attribute` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
ON DELETE CASCADE,
CONSTRAINT `fk_attribute_template`
FOREIGN KEY (`template_id`)
REFERENCES `template` (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
@@ -433,6 +434,8 @@ CREATE TABLE `customer`
`lang` VARCHAR(10),
`sponsor` VARCHAR(50),
`discount` FLOAT,
`remember_me_token` VARCHAR(255),
`remember_me_serial` VARCHAR(255),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
@@ -923,6 +926,8 @@ CREATE TABLE `admin`
`password` VARCHAR(128) NOT NULL,
`algo` VARCHAR(128),
`salt` VARCHAR(128),
`remember_me_token` VARCHAR(255),
`remember_me_serial` VARCHAR(255),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
@@ -1482,6 +1487,20 @@ CREATE TABLE `rewriting_argument`
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- template
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `template`;
CREATE TABLE `template`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- category_i18n
-- ---------------------------------------------------------------------
@@ -2060,6 +2079,24 @@ CREATE TABLE `folder_document_i18n`
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- template_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `template_i18n`;
CREATE TABLE `template_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`name` VARCHAR(255),
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `template_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `template` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- category_version
-- ---------------------------------------------------------------------
@@ -2097,6 +2134,7 @@ CREATE TABLE `product_version`
`ref` VARCHAR(255) NOT NULL,
`visible` TINYINT DEFAULT 0 NOT NULL,
`position` INTEGER NOT NULL,
`template_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
`version` INTEGER DEFAULT 0 NOT NULL,

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
<div class="form-group">
{ifloop rel="free_attributes"}
<select name="free_attributes" id="free_attributes" class="form-control">
<option value="">Select an attribute...</option>
{loop name="free_attributes" type="attribute" template="$template_id" backend_context="1" lang="$edit_language_id"}
<option value="{$ID}">{$TITLE}</option>
{/loop}
</select>
<span class="help-block">{intl l='Select an attribute and click (+) to add it to this template'}</span>
{/ifloop}
{elseloop rel="free_attributes"}
<div class="alert alert-info">There is currently no available attributes.</div>
{/elseloop}
</div>

View File

@@ -224,7 +224,7 @@
dialog_title = {intl l="Delete attribute"}
dialog_message = {intl l="Do you really want to delete this attribute ? It will be removed from all product templates."}
form_action = {url path='/admin/configuration/attributes/remove_from-all-templates' attribute_id=$ID}
form_action = {url path='/admin/configuration/attributes/delete'}
form_content = {$smarty.capture.delete_dialog nofilter}
}

View File

@@ -64,7 +64,7 @@
{block name="javascript-initialization"}
<script>
$(function () {
$(".feed-list").load("{admin_viewurl view='includes/thelia_news_feed'}");
$(".feed-list").load("{admin_viewurl view='ajax/thelia_news_feed'}");
})
</script>
{/block}

View File

@@ -0,0 +1,115 @@
{extends file="admin-layout.tpl"}
{block name="page-title"}{intl l='Edit a template'}{/block}
{block name="check-permissions"}admin.configuration.templates.edit{/block}
{block name="main-content"}
<div class="templates edit-template">
<div id="wrapper" class="container">
{loop name="template_edit" type="template" id="$template_id" backend_context="1" lang="$edit_language_id"}
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
<li><a href="{url path='/admin/configuration/templates'}">{intl l="Templates"}</a></li>
<li>{intl l='Editing template "%name"' name="{$NAME}"}</li>
</ul>
<div class="row">
<div class="col-md-12 general-block-decorator">
<div class="row">
<div class="col-md-12 title title-without-tabs">
{intl l="Edit template $NAME"}
</div>
<div class="form-container">
<div class="col-md-12">
{form name="thelia.admin.template.modification"}
<form method="POST" action="{url path='/admin/configuration/templates/save'}" {form_enctype form=$form} class="clearfix">
{* Be sure to get the template ID, even if the form could not be validated *}
<input type="hidden" name="template_id" value="{$template_id}" />
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/templates'}"}
{form_hidden_fields form=$form}
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/templates'}" />
{/form_field}
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
{/form_field}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
{form_field form=$form field='name'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Template name'}" placeholder="{intl l='Template name'}" class="form-control">
</div>
{/form_field}
</form>
{/form}
</div>
</div>
<div class="col-md-12">
<div class="form-container">
<div class="col-md-6">
<p class="title title-without-tabs">{intl l='Attributes'}</p>
<p>Manage attributes included in this product templates</p>
<div id="attribute_list_management">
<div class="loading"></div>
</div>
</div>
<div class="col-md-6">
<p class="title title-without-tabs">{intl l='Features'}</p>
<p>Manage features included in this product templates</p>
<div id="feature_list_management">
<div class="loading"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/loop}
{elseloop rel="template_edit"}
<div class="row">
<div class="col-md-12">
<div class="alert alert-error">
{intl l="Sorry, template ID=$template_id was not found."}
</div>
</div>
</div>
{/elseloop}
</div>
</div>
{/block}
{block name="javascript-initialization"}
<script>
$(function() {
$('#attribute_list_management').load("{admin_viewurl view='ajax/template-attribute-list' template_id=$template_id}");
$('#feature_list_management').load("{admin_viewurl view='ajax/template-feature-list' template_id=$template_id}");
});
</script>
{/block}

View File

@@ -0,0 +1,215 @@
{extends file="admin-layout.tpl"}
{block name="page-title"}{intl l='Thelia Product Templates'}{/block}
{block name="check-permissions"}admin.configuration.templates.view{/block}
{block name="main-content"}
<div class="templates">
<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/configuration'}">{intl l="Configuration"}</a></li>
<li><a href="{url path='/admin/configuration/templates'}">{intl l="Product templates"}</a></li>
</ul>
{module_include location='templates_top'}
<div class="row">
<div class="col-md-12">
<form action="#" method="post">
<div class="general-block-decorator">
{if ! empty($general_error) }
<div class="alert alert-danger">{$general_error}</div>
{/if}
<table class="table table-striped table-condensed table-left-aligned">
<caption>
{intl l='Thelia product templates'}
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.templates.create"}
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product template'}" href="#creation_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-plus-sign"></span>
</a>
{/loop}
</caption>
<thead>
<tr>
<th>
{admin_sortable_header
current_order=$order
order='id'
reverse_order='id_reverse'
path='/admin/configuration/templates'
label="{intl l='ID'}"
}
</th>
<th>
{admin_sortable_header
current_order=$order
order='alpha'
reverse_order='alpha_reverse'
path='/admin/configuration/templates'
label="{intl l='Title'}"
}
</th>
{module_include location='templates_table_header'}
<th class="actions">{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
{loop name="list" type="template" backend_context="1" lang=$lang_id order=$order}
<tr>
<td>{$ID}</td>
<td>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.templates.change"}
<a title="{intl l='Change this template'}" href="{url path='/admin/configuration/templates/update' template_id=$ID}">{$NAME}</a>
{/loop}
{elseloop rel="can_change"}
{$NAME}
{/elseloop}
</td>
{module_include location='templates_table_row'}
<td class="actions">
<div class="btn-group">
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.templates.change"}
<a class="btn btn-default btn-xs template-change" title="{intl l='Change this product template'}" href="{url path='/admin/configuration/templates/update' template_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
{/loop}
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.templates.delete"}
<a class="btn btn-default btn-xs template-delete" title="{intl l='Delete this product template'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
{/loop}
</div>
</td>
</tr>
{/loop}
{elseloop rel="list"}
<tr>
<td colspan="4">
<div class="alert alert-info">
{intl l="No product template has been created yet. Click the + button to create one."}
</div>
</td>
</tr>
{/elseloop}
</tbody>
</table>
</div>
</form>
</div>
</div>
{module_include location='templates_bottom'}
</div>
</div>
{* Adding a new template *}
{form name="thelia.admin.template.creation"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "creation_dialog"}
{form_hidden_fields form=$form}
{form_field form=$form field='success_url'}
{* on success, redirect to the edition page, _ID_ is replaced with the created template ID, see controller *}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/templates/update' template_id='_ID_'}" />
{/form_field}
{form_field form=$form field='name'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
{loop type="lang" name="default-lang" default_only="1"}
<div class="input-group">
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Template title'}" placeholder="{intl l='Title'}">
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
</div>
<div class="help-block">{intl l="Enter here the template name in the default language ($TITLE)"}</div>
{* Switch edition to the current locale *}
<input type="hidden" name="edit_language_id" value="{$ID}" />
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}
{/loop}
</div>
{/form_field}
{module_include location='template_create_form'}
{/capture}
{include
file = "includes/generic-create-dialog.html"
dialog_id = "creation_dialog"
dialog_title = {intl l="Create a new product template"}
dialog_body = {$smarty.capture.creation_dialog nofilter}
dialog_ok_label = {intl l="Create this product template"}
form_action = {url path='/admin/configuration/templates/create'}
form_enctype = {form_enctype form=$form}
form_error_message = $form_error_message
}
{/form}
{* Delete confirmation dialog *}
{capture "delete_dialog"}
<input type="hidden" name="template_id" id="template_delete_id" value="" />
{module_include location='template_delete_form'}
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "delete_dialog"
dialog_title = {intl l="Delete template"}
dialog_message = {intl l="Do you really want to delete this template ? It will be removed from all products."}
form_action = {url path='/admin/configuration/templates/delete'}
form_content = {$smarty.capture.delete_dialog nofilter}
}
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(function() {
// Set proper template ID in delete from
$('a.template-delete').click(function(ev) {
$('#template_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.template.creation"
}
});
</script>
{/block}