create a faker for adding some fixtures

This commit is contained in:
Manuel Raynaud
2013-04-30 14:12:52 +02:00
parent 1aaab031fc
commit 5b4daf0659
113 changed files with 3890 additions and 1548 deletions

View File

@@ -22,6 +22,9 @@
"symfony/yaml" : "2.2.*",
"symfony-cmf/routing": "1.0.0"
},
"require-dev" : {
"fzaninotto/faker": "dev-master"
},
"minimum-stability": "stable",
"config" : {
"vendor-dir" : "core/vendor",

55
composer.lock generated
View File

@@ -1,5 +1,9 @@
{
"hash": "05d2d7252b42f45fd8415a6c47087d97",
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "01f45cf9b2249fce35b127051f36f68d",
"packages": [
{
"name": "ezyang/htmlpurifier",
@@ -762,7 +766,51 @@
}
],
"packages-dev": [
{
"name": "fzaninotto/faker",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/fzaninotto/Faker.git",
"reference": "a9c1c8b76abe4622b285dcd7aa342cab9dfb6de6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fzaninotto/Faker/zipball/a9c1c8b76abe4622b285dcd7aa342cab9dfb6de6",
"reference": "a9c1c8b76abe4622b285dcd7aa342cab9dfb6de6",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-0": {
"Faker": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "François Zaninotto"
}
],
"description": "Faker is a PHP library that generates fake data for you.",
"keywords": [
"data",
"faker",
"fixtures"
],
"time": "2013-04-23 12:35:55"
}
],
"aliases": [
@@ -770,7 +818,8 @@
"minimum-stability": "stable",
"stability-flags": {
"ezyang/htmlpurifier": 20,
"ircmaxell/password-compat": 20
"ircmaxell/password-compat": 20,
"fzaninotto/faker": 20
},
"platform": {
"php": ">=5.3.7"

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<services>
<service id="thelia.action.cart" class="Thelia\Action\Cart">
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.customer" class="Thelia\Action\Customer">
<tag name="kernel.event_subscriber"/>
</service>
</services>
</config>

View File

@@ -12,87 +12,16 @@
<loop name="foo" class="Foo\Bar"/>
<loop name="fooz" class="Foo\Barz"/>
</loops>
<parameters>
<parameter key="router.request_context.class">Symfony\Component\Routing\RequestContext</parameter>
<parameter key="router.null_generator.class">Thelia\Routing\NullUrlGenerator</parameter>
<parameter key="router.dynamicRouter.class">Symfony\Cmf\Component\Routing\DynamicRouter</parameter>
<parameter key="router.chainRouter.class">Symfony\Cmf\Component\Routing\ChainRouter</parameter>
<parameter key="router.class">Symfony\Component\Routing\Router</parameter>
</parameters>
<services>
<service id="event_dispatcher" class="Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher">
<argument type="service" id="service_container" />
</service>
<service id="thelia.listener.view" class="Thelia\Core\EventListener\ViewListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="service_container"/>
</service>
<service id="controller.default" class="Thelia\Controller\DefaultController"/>
<service id="matcher.default" class="Thelia\Routing\Matcher\DefaultMatcher">
<argument type="service" id="controller.default"/>
</service>
<service id="request.context" class="%router.request_context.class%" />
<service id="router.null_generator" class="%router.null_generator.class%"/>
<service id="router.default_route" class="%router.dynamicRouter.class%">
<argument type="service" id="request.context"/>
<argument type="service" id="matcher.default"/>
<argument type="service" id="router.null_generator"/>
</service>
<service id="router.admin.fileLocator" class="Symfony\Component\Config\FileLocator">
<argument>%thelia.core_dir%/Config/Resources/</argument>
</service>
<service id="router.admin.xmlLoader" class="Symfony\Component\Routing\Loader\XmlFileLoader">
<argument type="service" id="router.admin.fileLocator"/>
</service>
<service id="router.admin" class="%router.class%">
<argument type="service" id="router.admin.xmlLoader"/>
<argument>routing.xml</argument>
<argument type="collection">
<argument key="cache_dir">%kernel.cache_dir%</argument>
<argument key="debug">%kernel.debug%</argument>
</argument>
<argument type="service" id="request.context"/>
</service>
<service id="router.chainRequest" class="%router.chainRouter.class%">
<call method="setContext">
<argument type="service" id="request.context"/>
</call>
<call method="add">
<argument type="service" id="router.default_route"/>
<argument>-255</argument>
</call>
<call method="add">
<argument type="service" id="router.admin"/>
<argument>0</argument>
</call>
</service>
<service id="listener.router" class="Symfony\Component\HttpKernel\EventListener\RouterListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="router.chainRequest"/>
</service>
<service id="thelia.request_listener" class="Thelia\Core\EventListener\RequestListener">
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.cart" class="Thelia\Action\Cart">
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.customer" class="Thelia\Action\Customer">
<tag name="kernel.event_subscriber"/>
</service>
<service id="controller_resolver" class="Symfony\Component\HttpKernel\Controller\ControllerResolver"/>
<service id="parser" class="Thelia\Core\Template\Parser">

View File

@@ -1,8 +1,75 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<import resource="admin_routing.xml" prefix="/admin" />
</routes>
<parameters>
<parameter key="router.request_context.class">Symfony\Component\Routing\RequestContext</parameter>
<parameter key="router.null_generator.class">Thelia\Routing\NullUrlGenerator</parameter>
<parameter key="router.dynamicRouter.class">Symfony\Cmf\Component\Routing\DynamicRouter</parameter>
<parameter key="router.chainRouter.class">Symfony\Cmf\Component\Routing\ChainRouter</parameter>
<parameter key="router.class">Symfony\Component\Routing\Router</parameter>
</parameters>
<services>
<service id="thelia.listener.view" class="Thelia\Core\EventListener\ViewListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="service_container"/>
</service>
<service id="controller.default" class="Thelia\Controller\DefaultController"/>
<service id="matcher.default" class="Thelia\Routing\Matcher\DefaultMatcher">
<argument type="service" id="controller.default"/>
</service>
<service id="request.context" class="%router.request_context.class%" />
<service id="router.null_generator" class="%router.null_generator.class%"/>
<service id="router.default_route" class="%router.dynamicRouter.class%">
<argument type="service" id="request.context"/>
<argument type="service" id="matcher.default"/>
<argument type="service" id="router.null_generator"/>
</service>
<service id="router.admin.fileLocator" class="Symfony\Component\Config\FileLocator">
<argument>%thelia.core_dir%/Config/Resources/routing</argument>
</service>
<service id="router.admin.xmlLoader" class="Symfony\Component\Routing\Loader\XmlFileLoader">
<argument type="service" id="router.admin.fileLocator"/>
</service>
<service id="router.admin" class="%router.class%">
<argument type="service" id="router.admin.xmlLoader"/>
<argument>routing.xml</argument>
<argument type="collection">
<argument key="cache_dir">%kernel.cache_dir%</argument>
<argument key="debug">%kernel.debug%</argument>
</argument>
<argument type="service" id="request.context"/>
</service>
<service id="router.chainRequest" class="%router.chainRouter.class%">
<call method="setContext">
<argument type="service" id="request.context"/>
</call>
<call method="add">
<argument type="service" id="router.default_route"/>
<argument>-255</argument>
</call>
<call method="add">
<argument type="service" id="router.admin"/>
<argument>0</argument>
</call>
</service>
<service id="listener.router" class="Symfony\Component\HttpKernel\EventListener\RouterListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="router.chainRequest"/>
</service>
</services>
</config>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<import resource="admin_routing.xml" prefix="/admin" />
</routes>

View File

@@ -107,6 +107,8 @@ class Thelia extends Kernel
$loader = new XmlFileLoader($container, new FileLocator(THELIA_ROOT . "/core/lib/Thelia/Config/Resources"));
$loader->load("config.xml");
$loader->load("routing.xml");
$loader->load("action.xml");
$modules = \Thelia\Model\ModuleQuery::getActivated();

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseAttributeAvDesc;
/**
* Skeleton subclass for representing a row from the 'attribute_av_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class AttributeAvDesc extends BaseAttributeAvDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseAttributeAvDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'attribute_av_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class AttributeAvDescPeer extends BaseAttributeAvDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseAttributeAvDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'attribute_av_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class AttributeAvDescQuery extends BaseAttributeAvDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseAttributeDesc;
/**
* Skeleton subclass for representing a row from the 'attribute_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class AttributeDesc extends BaseAttributeDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseAttributeDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'attribute_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class AttributeDescPeer extends BaseAttributeDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseAttributeDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'attribute_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class AttributeDescQuery extends BaseAttributeDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseCategoryDesc;
/**
* Skeleton subclass for representing a row from the 'category_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class CategoryDesc extends BaseCategoryDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseCategoryDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'category_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class CategoryDescPeer extends BaseCategoryDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseCategoryDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'category_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class CategoryDescQuery extends BaseCategoryDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseConfigDesc;
/**
* Skeleton subclass for representing a row from the 'config_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ConfigDesc extends BaseConfigDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseConfigDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'config_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ConfigDescPeer extends BaseConfigDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseConfigDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'config_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ConfigDescQuery extends BaseConfigDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseContentDesc;
/**
* Skeleton subclass for representing a row from the 'content_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ContentDesc extends BaseContentDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseContentDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'content_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ContentDescPeer extends BaseContentDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseContentDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'content_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ContentDescQuery extends BaseContentDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseCountryDesc;
/**
* Skeleton subclass for representing a row from the 'country_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class CountryDesc extends BaseCountryDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseCountryDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'country_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class CountryDescPeer extends BaseCountryDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseCountryDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'country_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class CountryDescQuery extends BaseCountryDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseCustomerTitleDesc;
/**
* Skeleton subclass for representing a row from the 'customer_title_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class CustomerTitleDesc extends BaseCustomerTitleDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseCustomerTitleDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'customer_title_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class CustomerTitleDescPeer extends BaseCustomerTitleDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseCustomerTitleDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'customer_title_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class CustomerTitleDescQuery extends BaseCustomerTitleDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseDocumentDesc;
/**
* Skeleton subclass for representing a row from the 'document_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class DocumentDesc extends BaseDocumentDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseDocumentDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'document_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class DocumentDescPeer extends BaseDocumentDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseDocumentDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'document_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class DocumentDescQuery extends BaseDocumentDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseFeatureAvDesc;
/**
* Skeleton subclass for representing a row from the 'feature_av_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class FeatureAvDesc extends BaseFeatureAvDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseFeatureAvDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'feature_av_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class FeatureAvDescPeer extends BaseFeatureAvDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseFeatureAvDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'feature_av_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class FeatureAvDescQuery extends BaseFeatureAvDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseFeatureDesc;
/**
* Skeleton subclass for representing a row from the 'feature_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class FeatureDesc extends BaseFeatureDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseFeatureDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'feature_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class FeatureDescPeer extends BaseFeatureDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseFeatureDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'feature_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class FeatureDescQuery extends BaseFeatureDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseFolderDesc;
/**
* Skeleton subclass for representing a row from the 'folder_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class FolderDesc extends BaseFolderDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseFolderDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'folder_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class FolderDescPeer extends BaseFolderDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseFolderDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'folder_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class FolderDescQuery extends BaseFolderDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseGroupDesc;
/**
* Skeleton subclass for representing a row from the 'group_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class GroupDesc extends BaseGroupDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseGroupDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'group_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class GroupDescPeer extends BaseGroupDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseGroupDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'group_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class GroupDescQuery extends BaseGroupDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseImageDesc;
/**
* Skeleton subclass for representing a row from the 'image_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ImageDesc extends BaseImageDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseImageDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'image_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ImageDescPeer extends BaseImageDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseImageDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'image_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ImageDescQuery extends BaseImageDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseMessageDesc;
/**
* Skeleton subclass for representing a row from the 'message_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class MessageDesc extends BaseMessageDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseMessageDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'message_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class MessageDescPeer extends BaseMessageDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseMessageDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'message_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class MessageDescQuery extends BaseMessageDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseModuleDesc;
/**
* Skeleton subclass for representing a row from the 'module_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ModuleDesc extends BaseModuleDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseModuleDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'module_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ModuleDescPeer extends BaseModuleDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseModuleDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'module_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ModuleDescQuery extends BaseModuleDescQuery
{
}

View File

@@ -18,6 +18,7 @@ use Thelia\Model\om\BaseModuleQuery;
*/
class ModuleQuery extends BaseModuleQuery
{
/**
* @return array|mixed|\PropelObjectCollection
*/

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseOrderStatusDesc;
/**
* Skeleton subclass for representing a row from the 'order_status_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class OrderStatusDesc extends BaseOrderStatusDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseOrderStatusDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'order_status_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class OrderStatusDescPeer extends BaseOrderStatusDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseOrderStatusDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'order_status_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class OrderStatusDescQuery extends BaseOrderStatusDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseProductDesc;
/**
* Skeleton subclass for representing a row from the 'product_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ProductDesc extends BaseProductDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseProductDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'product_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ProductDescPeer extends BaseProductDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseProductDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'product_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ProductDescQuery extends BaseProductDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseResourceDesc;
/**
* Skeleton subclass for representing a row from the 'resource_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ResourceDesc extends BaseResourceDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseResourceDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'resource_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ResourceDescPeer extends BaseResourceDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseResourceDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'resource_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class ResourceDescQuery extends BaseResourceDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseTaxDesc;
/**
* Skeleton subclass for representing a row from the 'tax_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class TaxDesc extends BaseTaxDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseTaxDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'tax_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class TaxDescPeer extends BaseTaxDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseTaxDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'tax_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class TaxDescQuery extends BaseTaxDescQuery
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseTaxRuleDesc;
/**
* Skeleton subclass for representing a row from the 'tax_rule_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class TaxRuleDesc extends BaseTaxRuleDesc
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseTaxRuleDescPeer;
/**
* Skeleton subclass for performing query and update operations on the 'tax_rule_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class TaxRuleDescPeer extends BaseTaxRuleDescPeer
{
}

View File

@@ -1,21 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\om\BaseTaxRuleDescQuery;
/**
* Skeleton subclass for performing query and update operations on the 'tax_rule_desc' 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.
*
* @package propel.generator.Thelia.Model
*/
class TaxRuleDescQuery extends BaseTaxRuleDescQuery
{
}

View File

@@ -41,6 +41,7 @@ class AccessoryTableMap extends TableMap
$this->setClassname('Thelia\\Model\\Accessory');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false);
$this->setIsCrossRef(true);
// columns
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('product_id', 'ProductId', 'INTEGER', 'product', 'id', true, null, null);

View File

@@ -41,10 +41,11 @@ class AdminGroupTableMap extends TableMap
$this->setClassname('Thelia\\Model\\AdminGroup');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
$this->setIsCrossRef(true);
// columns
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('group_id', 'GroupId', 'INTEGER', 'group', 'id', false, null, null);
$this->addForeignKey('admin_id', 'AdminId', 'INTEGER', 'admin', 'id', false, null, null);
$this->addForeignPrimaryKey('group_id', 'GroupId', 'INTEGER' , 'group', 'id', true, null, null);
$this->addForeignPrimaryKey('admin_id', 'AdminId', 'INTEGER' , 'admin', 'id', true, null, null);
$this->addColumn('created_at', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('updated_at', 'UpdatedAt', 'TIMESTAMP', false, null, null);
// validators

View File

@@ -60,6 +60,7 @@ class AdminTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('AdminGroup', 'Thelia\\Model\\AdminGroup', RelationMap::ONE_TO_MANY, array('id' => 'admin_id', ), 'CASCADE', 'RESTRICT', 'AdminGroups');
$this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Groups');
} // buildRelations()
/**

View File

@@ -41,6 +41,7 @@ class AttributeCategoryTableMap extends TableMap
$this->setClassname('Thelia\\Model\\AttributeCategory');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
$this->setIsCrossRef(true);
// columns
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('category_id', 'CategoryId', 'INTEGER', 'category', 'id', true, null, null);

View File

@@ -58,6 +58,7 @@ class AttributeTableMap extends TableMap
$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', 'AttributeCategorys');
$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', 'Categorys');
} // buildRelations()
/**

View File

@@ -69,6 +69,9 @@ class CategoryTableMap extends TableMap
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
$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()
/**

View File

@@ -41,6 +41,7 @@ class ContentFolderTableMap extends TableMap
$this->setClassname('Thelia\\Model\\ContentFolder');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false);
$this->setIsCrossRef(true);
// columns
$this->addForeignPrimaryKey('content_id', 'ContentId', 'INTEGER' , 'content', 'id', true, null, null);
$this->addForeignPrimaryKey('folder_id', 'FolderId', 'INTEGER' , 'folder', 'id', true, null, null);

View File

@@ -65,6 +65,7 @@ class ContentTableMap extends TableMap
$this->addRelation('ContentFolder', 'Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders');
$this->addRelation('ContentI18n', 'Thelia\\Model\\ContentI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentI18ns');
$this->addRelation('ContentVersion', 'Thelia\\Model\\ContentVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentVersions');
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Folders');
} // buildRelations()
/**

View File

@@ -41,6 +41,7 @@ class FeatureCategoryTableMap extends TableMap
$this->setClassname('Thelia\\Model\\FeatureCategory');
$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);

View File

@@ -59,6 +59,7 @@ class FeatureTableMap extends TableMap
$this->addRelation('FeatureProd', 'Thelia\\Model\\FeatureProd', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureProds');
$this->addRelation('FeatureCategory', 'Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureCategorys');
$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', 'Categorys');
} // buildRelations()
/**

View File

@@ -66,6 +66,7 @@ class FolderTableMap extends TableMap
$this->addRelation('ContentFolder', 'Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders');
$this->addRelation('FolderI18n', 'Thelia\\Model\\FolderI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'FolderI18ns');
$this->addRelation('FolderVersion', 'Thelia\\Model\\FolderVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'FolderVersions');
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Contents');
} // buildRelations()
/**

View File

@@ -41,10 +41,11 @@ class GroupResourceTableMap extends TableMap
$this->setClassname('Thelia\\Model\\GroupResource');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
$this->setIsCrossRef(true);
// columns
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('group_id', 'GroupId', 'INTEGER', 'group', 'id', true, null, null);
$this->addForeignKey('resource_id', 'ResourceId', 'INTEGER', 'resource', 'id', true, null, null);
$this->addForeignPrimaryKey('group_id', 'GroupId', 'INTEGER' , 'group', 'id', true, null, null);
$this->addForeignPrimaryKey('resource_id', 'ResourceId', 'INTEGER' , 'resource', 'id', true, null, null);
$this->addColumn('read', 'Read', 'TINYINT', false, null, 0);
$this->addColumn('write', 'Write', 'TINYINT', false, null, 0);
$this->addColumn('created_at', 'CreatedAt', 'TIMESTAMP', false, null, null);

View File

@@ -58,6 +58,8 @@ class GroupTableMap extends TableMap
$this->addRelation('GroupResource', 'Thelia\\Model\\GroupResource', RelationMap::ONE_TO_MANY, array('id' => 'group_id', ), 'CASCADE', 'RESTRICT', 'GroupResources');
$this->addRelation('GroupModule', 'Thelia\\Model\\GroupModule', RelationMap::ONE_TO_MANY, array('id' => 'group_id', ), 'CASCADE', 'CASCADE', 'GroupModules');
$this->addRelation('GroupI18n', 'Thelia\\Model\\GroupI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'GroupI18ns');
$this->addRelation('Admin', 'Thelia\\Model\\Admin', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Admins');
$this->addRelation('Resource', 'Thelia\\Model\\Resource', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Resources');
} // buildRelations()
/**

View File

@@ -41,6 +41,7 @@ class ProductCategoryTableMap extends TableMap
$this->setClassname('Thelia\\Model\\ProductCategory');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false);
$this->setIsCrossRef(true);
// columns
$this->addForeignPrimaryKey('product_id', 'ProductId', 'INTEGER' , 'product', 'id', true, null, null);
$this->addForeignPrimaryKey('category_id', 'CategoryId', 'INTEGER' , 'category', 'id', true, null, null);

View File

@@ -79,6 +79,9 @@ class ProductTableMap extends TableMap
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
$this->addRelation('ProductI18n', 'Thelia\\Model\\ProductI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductI18ns');
$this->addRelation('ProductVersion', 'Thelia\\Model\\ProductVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductVersions');
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Categorys');
$this->addRelation('ProductRelatedByAccessory', 'Thelia\\Model\\Product', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'ProductsRelatedByAccessory');
$this->addRelation('ProductRelatedByProductId', 'Thelia\\Model\\Product', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'ProductsRelatedByProductId');
} // buildRelations()
/**

View File

@@ -56,6 +56,7 @@ class ResourceTableMap extends TableMap
{
$this->addRelation('GroupResource', 'Thelia\\Model\\GroupResource', RelationMap::ONE_TO_MANY, array('id' => 'resource_id', ), 'CASCADE', 'RESTRICT', 'GroupResources');
$this->addRelation('ResourceI18n', 'Thelia\\Model\\ResourceI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ResourceI18ns');
$this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Groups');
} // buildRelations()
/**

View File

@@ -20,6 +20,8 @@ use Thelia\Model\AdminGroup;
use Thelia\Model\AdminGroupQuery;
use Thelia\Model\AdminPeer;
use Thelia\Model\AdminQuery;
use Thelia\Model\Group;
use Thelia\Model\GroupQuery;
/**
* Base class that represents a row from the 'admin' table.
@@ -109,6 +111,11 @@ abstract class BaseAdmin extends BaseObject implements Persistent
protected $collAdminGroups;
protected $collAdminGroupsPartial;
/**
* @var PropelObjectCollection|Group[] Collection to store aggregation of Group objects.
*/
protected $collGroups;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -129,6 +136,12 @@ abstract class BaseAdmin extends BaseObject implements Persistent
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $groupsScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
@@ -591,6 +604,7 @@ abstract class BaseAdmin extends BaseObject implements Persistent
$this->collAdminGroups = null;
$this->collGroups = null;
} // if (deep)
}
@@ -726,12 +740,37 @@ abstract class BaseAdmin extends BaseObject implements Persistent
$this->resetModified();
}
if ($this->groupsScheduledForDeletion !== null) {
if (!$this->groupsScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->groupsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($remotePk, $pk);
}
AdminGroupQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->groupsScheduledForDeletion = null;
}
foreach ($this->getGroups() as $group) {
if ($group->isModified()) {
$group->save($con);
}
}
} elseif ($this->collGroups) {
foreach ($this->collGroups as $group) {
if ($group->isModified()) {
$group->save($con);
}
}
}
if ($this->adminGroupsScheduledForDeletion !== null) {
if (!$this->adminGroupsScheduledForDeletion->isEmpty()) {
foreach ($this->adminGroupsScheduledForDeletion as $adminGroup) {
// need to save related object because we set the relation to null
$adminGroup->save($con);
}
AdminGroupQuery::create()
->filterByPrimaryKeys($this->adminGroupsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->adminGroupsScheduledForDeletion = null;
}
}
@@ -1523,7 +1562,7 @@ abstract class BaseAdmin extends BaseObject implements Persistent
$this->adminGroupsScheduledForDeletion = clone $this->collAdminGroups;
$this->adminGroupsScheduledForDeletion->clear();
}
$this->adminGroupsScheduledForDeletion[]= $adminGroup;
$this->adminGroupsScheduledForDeletion[]= clone $adminGroup;
$adminGroup->setAdmin(null);
}
@@ -1555,6 +1594,183 @@ abstract class BaseAdmin extends BaseObject implements Persistent
return $this->getAdminGroups($query, $con);
}
/**
* Clears out the collGroups 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 Admin The current object (for fluent API support)
* @see addGroups()
*/
public function clearGroups()
{
$this->collGroups = null; // important to set this to null since that means it is uninitialized
$this->collGroupsPartial = null;
return $this;
}
/**
* Initializes the collGroups collection.
*
* By default this just sets the collGroups collection to an empty collection (like clearGroups());
* 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 initGroups()
{
$this->collGroups = new PropelObjectCollection();
$this->collGroups->setModel('Group');
}
/**
* Gets a collection of Group objects related by a many-to-many relationship
* to the current object by way of the admin_group 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.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this Admin is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria Optional query object to filter the query
* @param PropelPDO $con Optional connection object
*
* @return PropelObjectCollection|Group[] List of Group objects
*/
public function getGroups($criteria = null, PropelPDO $con = null)
{
if (null === $this->collGroups || null !== $criteria) {
if ($this->isNew() && null === $this->collGroups) {
// return empty collection
$this->initGroups();
} else {
$collGroups = GroupQuery::create(null, $criteria)
->filterByAdmin($this)
->find($con);
if (null !== $criteria) {
return $collGroups;
}
$this->collGroups = $collGroups;
}
}
return $this->collGroups;
}
/**
* Sets a collection of Group objects related by a many-to-many relationship
* to the current object by way of the admin_group 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 PropelCollection $groups A Propel collection.
* @param PropelPDO $con Optional connection object
* @return Admin The current object (for fluent API support)
*/
public function setGroups(PropelCollection $groups, PropelPDO $con = null)
{
$this->clearGroups();
$currentGroups = $this->getGroups();
$this->groupsScheduledForDeletion = $currentGroups->diff($groups);
foreach ($groups as $group) {
if (!$currentGroups->contains($group)) {
$this->doAddGroup($group);
}
}
$this->collGroups = $groups;
return $this;
}
/**
* Gets the number of Group objects related by a many-to-many relationship
* to the current object by way of the admin_group cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param PropelPDO $con Optional connection object
*
* @return int the number of related Group objects
*/
public function countGroups($criteria = null, $distinct = false, PropelPDO $con = null)
{
if (null === $this->collGroups || null !== $criteria) {
if ($this->isNew() && null === $this->collGroups) {
return 0;
} else {
$query = GroupQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByAdmin($this)
->count($con);
}
} else {
return count($this->collGroups);
}
}
/**
* Associate a Group object to this object
* through the admin_group cross reference table.
*
* @param Group $group The AdminGroup object to relate
* @return Admin The current object (for fluent API support)
*/
public function addGroup(Group $group)
{
if ($this->collGroups === null) {
$this->initGroups();
}
if (!$this->collGroups->contains($group)) { // only add it if the **same** object is not already associated
$this->doAddGroup($group);
$this->collGroups[]= $group;
}
return $this;
}
/**
* @param Group $group The group object to add.
*/
protected function doAddGroup($group)
{
$adminGroup = new AdminGroup();
$adminGroup->setGroup($group);
$this->addAdminGroup($adminGroup);
}
/**
* Remove a Group object to this object
* through the admin_group cross reference table.
*
* @param Group $group The AdminGroup object to relate
* @return Admin The current object (for fluent API support)
*/
public function removeGroup(Group $group)
{
if ($this->getGroups()->contains($group)) {
$this->collGroups->remove($this->collGroups->search($group));
if (null === $this->groupsScheduledForDeletion) {
$this->groupsScheduledForDeletion = clone $this->collGroups;
$this->groupsScheduledForDeletion->clear();
}
$this->groupsScheduledForDeletion[]= $group;
}
return $this;
}
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -1596,6 +1812,11 @@ abstract class BaseAdmin extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
if ($this->collGroups) {
foreach ($this->collGroups as $o) {
$o->clearAllReferences($deep);
}
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
@@ -1604,6 +1825,10 @@ abstract class BaseAdmin extends BaseObject implements Persistent
$this->collAdminGroups->clearIterator();
}
$this->collAdminGroups = null;
if ($this->collGroups instanceof PropelCollection) {
$this->collGroups->clearIterator();
}
$this->collGroups = null;
}
/**

View File

@@ -862,10 +862,10 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['AdminGroup'][$this->getPrimaryKey()])) {
if (isset($alreadyDumpedObjects['AdminGroup'][serialize($this->getPrimaryKey())])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['AdminGroup'][$this->getPrimaryKey()] = true;
$alreadyDumpedObjects['AdminGroup'][serialize($this->getPrimaryKey())] = true;
$keys = AdminGroupPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
@@ -991,28 +991,38 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
{
$criteria = new Criteria(AdminGroupPeer::DATABASE_NAME);
$criteria->add(AdminGroupPeer::ID, $this->id);
$criteria->add(AdminGroupPeer::GROUP_ID, $this->group_id);
$criteria->add(AdminGroupPeer::ADMIN_ID, $this->admin_id);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return int
* Returns the composite primary key for this object.
* The array elements will be in same order as specified in XML.
* @return array
*/
public function getPrimaryKey()
{
return $this->getId();
$pks = array();
$pks[0] = $this->getId();
$pks[1] = $this->getGroupId();
$pks[2] = $this->getAdminId();
return $pks;
}
/**
* Generic method to set the primary key (id column).
* Set the [composite] primary key.
*
* @param int $key Primary key.
* @param array $keys The elements of the composite key (order must match the order in XML file).
* @return void
*/
public function setPrimaryKey($key)
public function setPrimaryKey($keys)
{
$this->setId($key);
$this->setId($keys[0]);
$this->setGroupId($keys[1]);
$this->setAdminId($keys[2]);
}
/**
@@ -1022,7 +1032,7 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
public function isPrimaryKeyNull()
{
return null === $this->getId();
return (null === $this->getId()) && (null === $this->getGroupId()) && (null === $this->getAdminId());
}
/**

View File

@@ -311,7 +311,7 @@ abstract class BaseAdminGroupPeer
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
$key = serialize(array((string) $obj->getId(), (string) $obj->getGroupId(), (string) $obj->getAdminId()));
} // if key === null
AdminGroupPeer::$instances[$key] = $obj;
}
@@ -334,10 +334,10 @@ abstract class BaseAdminGroupPeer
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof AdminGroup) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
$key = serialize(array((string) $value->getId(), (string) $value->getGroupId(), (string) $value->getAdminId()));
} elseif (is_array($value) && count($value) === 3) {
// assume we've been passed a primary key
$key = (string) $value;
$key = serialize(array((string) $value[0], (string) $value[1], (string) $value[2]));
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AdminGroup object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
@@ -406,11 +406,11 @@ abstract class BaseAdminGroupPeer
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
if ($row[$startcol] === null && $row[$startcol + 1] === null && $row[$startcol + 2] === null) {
return null;
}
return (string) $row[$startcol];
return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1], (string) $row[$startcol + 2]));
}
/**
@@ -425,7 +425,7 @@ abstract class BaseAdminGroupPeer
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
return array((int) $row[$startcol], (int) $row[$startcol + 1], (int) $row[$startcol + 2]);
}
/**
@@ -1223,6 +1223,22 @@ abstract class BaseAdminGroupPeer
$selectCriteria->setPrimaryTableName(AdminGroupPeer::TABLE_NAME);
}
$comparison = $criteria->getComparison(AdminGroupPeer::GROUP_ID);
$value = $criteria->remove(AdminGroupPeer::GROUP_ID);
if ($value) {
$selectCriteria->add(AdminGroupPeer::GROUP_ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(AdminGroupPeer::TABLE_NAME);
}
$comparison = $criteria->getComparison(AdminGroupPeer::ADMIN_ID);
$value = $criteria->remove(AdminGroupPeer::ADMIN_ID);
if ($value) {
$selectCriteria->add(AdminGroupPeer::ADMIN_ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(AdminGroupPeer::TABLE_NAME);
}
} else { // $values is AdminGroup object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
@@ -1297,10 +1313,19 @@ abstract class BaseAdminGroupPeer
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(AdminGroupPeer::DATABASE_NAME);
$criteria->add(AdminGroupPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
AdminGroupPeer::removeInstanceFromPool($singleval);
// 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(AdminGroupPeer::ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(AdminGroupPeer::GROUP_ID, $value[1]));
$criterion->addAnd($criteria->getNewCriterion(AdminGroupPeer::ADMIN_ID, $value[2]));
$criteria->addOr($criterion);
// we can invalidate the cache for this single PK
AdminGroupPeer::removeInstanceFromPool($value);
}
}
@@ -1363,58 +1388,30 @@ abstract class BaseAdminGroupPeer
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* Retrieve object using using composite pkey values.
* @param int $id
* @param int $group_id
* @param int $admin_id
* @param PropelPDO $con
* @return AdminGroup
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = AdminGroupPeer::getInstanceFromPool((string) $pk))) {
public static function retrieveByPK($id, $group_id, $admin_id, PropelPDO $con = null) {
$_instancePoolKey = serialize(array((string) $id, (string) $group_id, (string) $admin_id));
if (null !== ($obj = AdminGroupPeer::getInstanceFromPool($_instancePoolKey))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(AdminGroupPeer::DATABASE_NAME);
$criteria->add(AdminGroupPeer::ID, $pk);
$criteria->add(AdminGroupPeer::ID, $id);
$criteria->add(AdminGroupPeer::GROUP_ID, $group_id);
$criteria->add(AdminGroupPeer::ADMIN_ID, $admin_id);
$v = AdminGroupPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
return !empty($v) ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return AdminGroup[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(AdminGroupPeer::DATABASE_NAME);
$criteria->add(AdminGroupPeer::ID, $pks, Criteria::IN);
$objs = AdminGroupPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseAdminGroupPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.

View File

@@ -50,6 +50,7 @@ use Thelia\Model\Group;
* @method AdminGroup findOne(PropelPDO $con = null) Return the first AdminGroup matching the query
* @method AdminGroup findOneOrCreate(PropelPDO $con = null) Return the first AdminGroup matching the query, or a new AdminGroup object populated from the query conditions when no match is found
*
* @method AdminGroup findOneById(int $id) Return the first AdminGroup filtered by the id column
* @method AdminGroup findOneByGroupId(int $group_id) Return the first AdminGroup filtered by the group_id column
* @method AdminGroup findOneByAdminId(int $admin_id) Return the first AdminGroup filtered by the admin_id column
* @method AdminGroup findOneByCreatedAt(string $created_at) Return the first AdminGroup filtered by the created_at column
@@ -107,10 +108,11 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* $obj = $c->findPk(array(12, 34, 56), $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param array $key Primary key to use for the query
A Primary key composition: [$id, $group_id, $admin_id]
* @param PropelPDO $con an optional connection object
*
* @return AdminGroup|AdminGroup[]|mixed the result, formatted by the current formatter
@@ -120,7 +122,7 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
if ($key === null) {
return null;
}
if ((null !== ($obj = AdminGroupPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
if ((null !== ($obj = AdminGroupPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1], (string) $key[2]))))) && !$this->formatter) {
// the object is alredy in the instance pool
return $obj;
}
@@ -137,20 +139,6 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return AdminGroup A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneById($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
@@ -163,10 +151,12 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `id`, `group_id`, `admin_id`, `created_at`, `updated_at` FROM `admin_group` WHERE `id` = :p0';
$sql = 'SELECT `id`, `group_id`, `admin_id`, `created_at`, `updated_at` FROM `admin_group` WHERE `id` = :p0 AND `group_id` = :p1 AND `admin_id` = :p2';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->bindValue(':p2', $key[2], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
@@ -176,7 +166,7 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new AdminGroup();
$obj->hydrate($row);
AdminGroupPeer::addInstanceToPool($obj, (string) $key);
AdminGroupPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1], (string) $key[2])));
}
$stmt->closeCursor();
@@ -205,7 +195,7 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* $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 PropelPDO $con an optional connection object
@@ -235,8 +225,11 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(AdminGroupPeer::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(AdminGroupPeer::GROUP_ID, $key[1], Criteria::EQUAL);
$this->addUsingAlias(AdminGroupPeer::ADMIN_ID, $key[2], Criteria::EQUAL);
return $this->addUsingAlias(AdminGroupPeer::ID, $key, Criteria::EQUAL);
return $this;
}
/**
@@ -248,8 +241,19 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(AdminGroupPeer::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(AdminGroupPeer::GROUP_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$cton2 = $this->getNewCriterion(AdminGroupPeer::ADMIN_ID, $key[2], Criteria::EQUAL);
$cton0->addAnd($cton2);
$this->addOr($cton0);
}
return $this->addUsingAlias(AdminGroupPeer::ID, $keys, Criteria::IN);
return $this;
}
/**
@@ -502,7 +506,7 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
*
* @return AdminGroupQuery The current query, for fluid interface
*/
public function joinGroup($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function joinGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Group');
@@ -537,7 +541,7 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
*
* @return \Thelia\Model\GroupQuery A secondary query class using the current class as primary query
*/
public function useGroupQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function useGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinGroup($relationAlias, $joinType)
@@ -578,7 +582,7 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
*
* @return AdminGroupQuery The current query, for fluid interface
*/
public function joinAdmin($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function joinAdmin($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Admin');
@@ -613,7 +617,7 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
*
* @return \Thelia\Model\AdminQuery A secondary query class using the current class as primary query
*/
public function useAdminQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function useAdminQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAdmin($relationAlias, $joinType)
@@ -630,7 +634,10 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
public function prune($adminGroup = null)
{
if ($adminGroup) {
$this->addUsingAlias(AdminGroupPeer::ID, $adminGroup->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond0', $this->getAliasedColName(AdminGroupPeer::ID), $adminGroup->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(AdminGroupPeer::GROUP_ID), $adminGroup->getGroupId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond2', $this->getAliasedColName(AdminGroupPeer::ADMIN_ID), $adminGroup->getAdminId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1', 'pruneCond2'), Criteria::LOGICAL_OR);
}
return $this;

View File

@@ -16,6 +16,7 @@ use Thelia\Model\Admin;
use Thelia\Model\AdminGroup;
use Thelia\Model\AdminPeer;
use Thelia\Model\AdminQuery;
use Thelia\Model\Group;
/**
* Base class that represents a query for the 'admin' table.
@@ -597,7 +598,7 @@ abstract class BaseAdminQuery extends ModelCriteria
*
* @return AdminQuery The current query, for fluid interface
*/
public function joinAdminGroup($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function joinAdminGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AdminGroup');
@@ -632,13 +633,30 @@ abstract class BaseAdminQuery extends ModelCriteria
*
* @return \Thelia\Model\AdminGroupQuery A secondary query class using the current class as primary query
*/
public function useAdminGroupQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
public function useAdminGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAdminGroup($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AdminGroup', '\Thelia\Model\AdminGroupQuery');
}
/**
* Filter the query by a related Group object
* using the admin_group table as cross reference
*
* @param Group $group the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AdminQuery The current query, for fluid interface
*/
public function filterByGroup($group, $comparison = Criteria::EQUAL)
{
return $this
->useAdminGroupQuery()
->filterByGroup($group, $comparison)
->endUse();
}
/**
* Exclude object from result
*

View File

@@ -26,6 +26,8 @@ use Thelia\Model\AttributeI18n;
use Thelia\Model\AttributeI18nQuery;
use Thelia\Model\AttributePeer;
use Thelia\Model\AttributeQuery;
use Thelia\Model\Category;
use Thelia\Model\CategoryQuery;
/**
* Base class that represents a row from the 'attribute' table.
@@ -103,6 +105,11 @@ abstract class BaseAttribute extends BaseObject implements Persistent
protected $collAttributeI18ns;
protected $collAttributeI18nsPartial;
/**
* @var PropelObjectCollection|Category[] Collection to store aggregation of Category objects.
*/
protected $collCategorys;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -137,6 +144,12 @@ abstract class BaseAttribute extends BaseObject implements Persistent
*/
protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $categorysScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
@@ -463,6 +476,7 @@ abstract class BaseAttribute extends BaseObject implements Persistent
$this->collAttributeI18ns = null;
$this->collCategorys = null;
} // if (deep)
}
@@ -598,6 +612,32 @@ abstract class BaseAttribute extends BaseObject implements Persistent
$this->resetModified();
}
if ($this->categorysScheduledForDeletion !== null) {
if (!$this->categorysScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->categorysScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($remotePk, $pk);
}
AttributeCategoryQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->categorysScheduledForDeletion = null;
}
foreach ($this->getCategorys() as $category) {
if ($category->isModified()) {
$category->save($con);
}
}
} elseif ($this->collCategorys) {
foreach ($this->collCategorys as $category) {
if ($category->isModified()) {
$category->save($con);
}
}
}
if ($this->attributeAvsScheduledForDeletion !== null) {
if (!$this->attributeAvsScheduledForDeletion->isEmpty()) {
AttributeAvQuery::create()
@@ -2165,6 +2205,183 @@ abstract class BaseAttribute extends BaseObject implements Persistent
return $this;
}
/**
* Clears out the collCategorys 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 Attribute The current object (for fluent API support)
* @see addCategorys()
*/
public function clearCategorys()
{
$this->collCategorys = null; // important to set this to null since that means it is uninitialized
$this->collCategorysPartial = null;
return $this;
}
/**
* Initializes the collCategorys collection.
*
* By default this just sets the collCategorys collection to an empty collection (like clearCategorys());
* 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 initCategorys()
{
$this->collCategorys = new PropelObjectCollection();
$this->collCategorys->setModel('Category');
}
/**
* Gets 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.
*
* 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.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this Attribute is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria Optional query object to filter the query
* @param PropelPDO $con Optional connection object
*
* @return PropelObjectCollection|Category[] List of Category objects
*/
public function getCategorys($criteria = null, PropelPDO $con = null)
{
if (null === $this->collCategorys || null !== $criteria) {
if ($this->isNew() && null === $this->collCategorys) {
// return empty collection
$this->initCategorys();
} else {
$collCategorys = CategoryQuery::create(null, $criteria)
->filterByAttribute($this)
->find($con);
if (null !== $criteria) {
return $collCategorys;
}
$this->collCategorys = $collCategorys;
}
}
return $this->collCategorys;
}
/**
* 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.
* 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 PropelCollection $categorys A Propel collection.
* @param PropelPDO $con Optional connection object
* @return Attribute The current object (for fluent API support)
*/
public function setCategorys(PropelCollection $categorys, PropelPDO $con = null)
{
$this->clearCategorys();
$currentCategorys = $this->getCategorys();
$this->categorysScheduledForDeletion = $currentCategorys->diff($categorys);
foreach ($categorys as $category) {
if (!$currentCategorys->contains($category)) {
$this->doAddCategory($category);
}
}
$this->collCategorys = $categorys;
return $this;
}
/**
* Gets the number of Category objects related by a many-to-many relationship
* to the current object by way of the attribute_category cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param PropelPDO $con Optional connection object
*
* @return int the number of related Category objects
*/
public function countCategorys($criteria = null, $distinct = false, PropelPDO $con = null)
{
if (null === $this->collCategorys || null !== $criteria) {
if ($this->isNew() && null === $this->collCategorys) {
return 0;
} else {
$query = CategoryQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByAttribute($this)
->count($con);
}
} else {
return count($this->collCategorys);
}
}
/**
* Associate a Category object to this object
* through the attribute_category cross reference table.
*
* @param Category $category The AttributeCategory object to relate
* @return Attribute The current object (for fluent API support)
*/
public function addCategory(Category $category)
{
if ($this->collCategorys === null) {
$this->initCategorys();
}
if (!$this->collCategorys->contains($category)) { // only add it if the **same** object is not already associated
$this->doAddCategory($category);
$this->collCategorys[]= $category;
}
return $this;
}
/**
* @param Category $category The category object to add.
*/
protected function doAddCategory($category)
{
$attributeCategory = new AttributeCategory();
$attributeCategory->setCategory($category);
$this->addAttributeCategory($attributeCategory);
}
/**
* Remove a Category object to this object
* through the attribute_category cross reference table.
*
* @param Category $category The AttributeCategory object to relate
* @return Attribute The current object (for fluent API support)
*/
public function removeCategory(Category $category)
{
if ($this->getCategorys()->contains($category)) {
$this->collCategorys->remove($this->collCategorys->search($category));
if (null === $this->categorysScheduledForDeletion) {
$this->categorysScheduledForDeletion = clone $this->collCategorys;
$this->categorysScheduledForDeletion->clear();
}
$this->categorysScheduledForDeletion[]= $category;
}
return $this;
}
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -2216,6 +2433,11 @@ abstract class BaseAttribute extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
if ($this->collCategorys) {
foreach ($this->collCategorys as $o) {
$o->clearAllReferences($deep);
}
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
@@ -2240,6 +2462,10 @@ abstract class BaseAttribute extends BaseObject implements Persistent
$this->collAttributeI18ns->clearIterator();
}
$this->collAttributeI18ns = null;
if ($this->collCategorys instanceof PropelCollection) {
$this->collCategorys->clearIterator();
}
$this->collCategorys = null;
}
/**

View File

@@ -19,6 +19,7 @@ use Thelia\Model\AttributeCombination;
use Thelia\Model\AttributeI18n;
use Thelia\Model\AttributePeer;
use Thelia\Model\AttributeQuery;
use Thelia\Model\Category;
/**
* Base class that represents a query for the 'attribute' table.
@@ -724,6 +725,23 @@ abstract class BaseAttributeQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'AttributeI18n', '\Thelia\Model\AttributeI18nQuery');
}
/**
* Filter the query by a related Category object
* using the attribute_category table as cross reference
*
* @param Category $category the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return AttributeQuery The current query, for fluid interface
*/
public function filterByCategory($category, $comparison = Criteria::EQUAL)
{
return $this
->useAttributeCategoryQuery()
->filterByCategory($category, $comparison)
->endUse();
}
/**
* Exclude object from result
*

View File

@@ -15,8 +15,10 @@ use \PropelDateTime;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Attribute;
use Thelia\Model\AttributeCategory;
use Thelia\Model\AttributeCategoryQuery;
use Thelia\Model\AttributeQuery;
use Thelia\Model\Category;
use Thelia\Model\CategoryI18n;
use Thelia\Model\CategoryI18nQuery;
@@ -29,12 +31,16 @@ use Thelia\Model\ContentAssoc;
use Thelia\Model\ContentAssocQuery;
use Thelia\Model\Document;
use Thelia\Model\DocumentQuery;
use Thelia\Model\Feature;
use Thelia\Model\FeatureCategory;
use Thelia\Model\FeatureCategoryQuery;
use Thelia\Model\FeatureQuery;
use Thelia\Model\Image;
use Thelia\Model\ImageQuery;
use Thelia\Model\Product;
use Thelia\Model\ProductCategory;
use Thelia\Model\ProductCategoryQuery;
use Thelia\Model\ProductQuery;
use Thelia\Model\Rewriting;
use Thelia\Model\RewritingQuery;
@@ -181,6 +187,21 @@ abstract class BaseCategory extends BaseObject implements Persistent
protected $collCategoryVersions;
protected $collCategoryVersionsPartial;
/**
* @var PropelObjectCollection|Product[] Collection to store aggregation of Product objects.
*/
protected $collProducts;
/**
* @var PropelObjectCollection|Feature[] Collection to store aggregation of Feature objects.
*/
protected $collFeatures;
/**
* @var PropelObjectCollection|Attribute[] Collection to store aggregation of Attribute objects.
*/
protected $collAttributes;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -223,6 +244,24 @@ abstract class BaseCategory extends BaseObject implements Persistent
*/
protected $enforceVersion = false;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $productsScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $featuresScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $attributesScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
@@ -838,6 +877,9 @@ abstract class BaseCategory extends BaseObject implements Persistent
$this->collCategoryVersions = null;
$this->collProducts = null;
$this->collFeatures = null;
$this->collAttributes = null;
} // if (deep)
}
@@ -985,6 +1027,84 @@ abstract class BaseCategory extends BaseObject implements Persistent
$this->resetModified();
}
if ($this->productsScheduledForDeletion !== null) {
if (!$this->productsScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->productsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($remotePk, $pk);
}
ProductCategoryQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->productsScheduledForDeletion = null;
}
foreach ($this->getProducts() as $product) {
if ($product->isModified()) {
$product->save($con);
}
}
} elseif ($this->collProducts) {
foreach ($this->collProducts as $product) {
if ($product->isModified()) {
$product->save($con);
}
}
}
if ($this->featuresScheduledForDeletion !== null) {
if (!$this->featuresScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->featuresScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($pk, $remotePk);
}
FeatureCategoryQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->featuresScheduledForDeletion = null;
}
foreach ($this->getFeatures() as $feature) {
if ($feature->isModified()) {
$feature->save($con);
}
}
} elseif ($this->collFeatures) {
foreach ($this->collFeatures as $feature) {
if ($feature->isModified()) {
$feature->save($con);
}
}
}
if ($this->attributesScheduledForDeletion !== null) {
if (!$this->attributesScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->attributesScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($pk, $remotePk);
}
AttributeCategoryQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->attributesScheduledForDeletion = null;
}
foreach ($this->getAttributes() as $attribute) {
if ($attribute->isModified()) {
$attribute->save($con);
}
}
} elseif ($this->collAttributes) {
foreach ($this->collAttributes as $attribute) {
if ($attribute->isModified()) {
$attribute->save($con);
}
}
}
if ($this->productCategorysScheduledForDeletion !== null) {
if (!$this->productCategorysScheduledForDeletion->isEmpty()) {
ProductCategoryQuery::create()
@@ -4202,6 +4322,537 @@ abstract class BaseCategory extends BaseObject implements Persistent
return $this;
}
/**
* Clears out the collProducts 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 Category The current object (for fluent API support)
* @see addProducts()
*/
public function clearProducts()
{
$this->collProducts = null; // important to set this to null since that means it is uninitialized
$this->collProductsPartial = null;
return $this;
}
/**
* Initializes the collProducts collection.
*
* By default this just sets the collProducts collection to an empty collection (like clearProducts());
* 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 initProducts()
{
$this->collProducts = new PropelObjectCollection();
$this->collProducts->setModel('Product');
}
/**
* Gets a collection of Product objects related by a many-to-many relationship
* to the current object by way of the product_category 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.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this Category is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria Optional query object to filter the query
* @param PropelPDO $con Optional connection object
*
* @return PropelObjectCollection|Product[] List of Product objects
*/
public function getProducts($criteria = null, PropelPDO $con = null)
{
if (null === $this->collProducts || null !== $criteria) {
if ($this->isNew() && null === $this->collProducts) {
// return empty collection
$this->initProducts();
} else {
$collProducts = ProductQuery::create(null, $criteria)
->filterByCategory($this)
->find($con);
if (null !== $criteria) {
return $collProducts;
}
$this->collProducts = $collProducts;
}
}
return $this->collProducts;
}
/**
* Sets a collection of Product objects related by a many-to-many relationship
* to the current object by way of the product_category 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 PropelCollection $products A Propel collection.
* @param PropelPDO $con Optional connection object
* @return Category The current object (for fluent API support)
*/
public function setProducts(PropelCollection $products, PropelPDO $con = null)
{
$this->clearProducts();
$currentProducts = $this->getProducts();
$this->productsScheduledForDeletion = $currentProducts->diff($products);
foreach ($products as $product) {
if (!$currentProducts->contains($product)) {
$this->doAddProduct($product);
}
}
$this->collProducts = $products;
return $this;
}
/**
* Gets the number of Product objects related by a many-to-many relationship
* to the current object by way of the product_category cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param PropelPDO $con Optional connection object
*
* @return int the number of related Product objects
*/
public function countProducts($criteria = null, $distinct = false, PropelPDO $con = null)
{
if (null === $this->collProducts || null !== $criteria) {
if ($this->isNew() && null === $this->collProducts) {
return 0;
} else {
$query = ProductQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByCategory($this)
->count($con);
}
} else {
return count($this->collProducts);
}
}
/**
* Associate a Product object to this object
* through the product_category cross reference table.
*
* @param Product $product The ProductCategory object to relate
* @return Category The current object (for fluent API support)
*/
public function addProduct(Product $product)
{
if ($this->collProducts === null) {
$this->initProducts();
}
if (!$this->collProducts->contains($product)) { // only add it if the **same** object is not already associated
$this->doAddProduct($product);
$this->collProducts[]= $product;
}
return $this;
}
/**
* @param Product $product The product object to add.
*/
protected function doAddProduct($product)
{
$productCategory = new ProductCategory();
$productCategory->setProduct($product);
$this->addProductCategory($productCategory);
}
/**
* Remove a Product object to this object
* through the product_category cross reference table.
*
* @param Product $product The ProductCategory object to relate
* @return Category The current object (for fluent API support)
*/
public function removeProduct(Product $product)
{
if ($this->getProducts()->contains($product)) {
$this->collProducts->remove($this->collProducts->search($product));
if (null === $this->productsScheduledForDeletion) {
$this->productsScheduledForDeletion = clone $this->collProducts;
$this->productsScheduledForDeletion->clear();
}
$this->productsScheduledForDeletion[]= $product;
}
return $this;
}
/**
* Clears out the collFeatures 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 Category The current object (for fluent API support)
* @see addFeatures()
*/
public function clearFeatures()
{
$this->collFeatures = null; // important to set this to null since that means it is uninitialized
$this->collFeaturesPartial = null;
return $this;
}
/**
* Initializes the collFeatures collection.
*
* By default this just sets the collFeatures collection to an empty collection (like clearFeatures());
* 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 initFeatures()
{
$this->collFeatures = new PropelObjectCollection();
$this->collFeatures->setModel('Feature');
}
/**
* Gets a collection of Feature objects related by a many-to-many relationship
* to the current object by way of the feature_category 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.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this Category is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria Optional query object to filter the query
* @param PropelPDO $con Optional connection object
*
* @return PropelObjectCollection|Feature[] List of Feature objects
*/
public function getFeatures($criteria = null, PropelPDO $con = null)
{
if (null === $this->collFeatures || null !== $criteria) {
if ($this->isNew() && null === $this->collFeatures) {
// return empty collection
$this->initFeatures();
} else {
$collFeatures = FeatureQuery::create(null, $criteria)
->filterByCategory($this)
->find($con);
if (null !== $criteria) {
return $collFeatures;
}
$this->collFeatures = $collFeatures;
}
}
return $this->collFeatures;
}
/**
* Sets a collection of Feature objects related by a many-to-many relationship
* to the current object by way of the feature_category 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 PropelCollection $features A Propel collection.
* @param PropelPDO $con Optional connection object
* @return Category The current object (for fluent API support)
*/
public function setFeatures(PropelCollection $features, PropelPDO $con = null)
{
$this->clearFeatures();
$currentFeatures = $this->getFeatures();
$this->featuresScheduledForDeletion = $currentFeatures->diff($features);
foreach ($features as $feature) {
if (!$currentFeatures->contains($feature)) {
$this->doAddFeature($feature);
}
}
$this->collFeatures = $features;
return $this;
}
/**
* Gets the number of Feature objects related by a many-to-many relationship
* to the current object by way of the feature_category cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param PropelPDO $con Optional connection object
*
* @return int the number of related Feature objects
*/
public function countFeatures($criteria = null, $distinct = false, PropelPDO $con = null)
{
if (null === $this->collFeatures || null !== $criteria) {
if ($this->isNew() && null === $this->collFeatures) {
return 0;
} else {
$query = FeatureQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByCategory($this)
->count($con);
}
} else {
return count($this->collFeatures);
}
}
/**
* Associate a Feature object to this object
* through the feature_category cross reference table.
*
* @param Feature $feature The FeatureCategory object to relate
* @return Category The current object (for fluent API support)
*/
public function addFeature(Feature $feature)
{
if ($this->collFeatures === null) {
$this->initFeatures();
}
if (!$this->collFeatures->contains($feature)) { // only add it if the **same** object is not already associated
$this->doAddFeature($feature);
$this->collFeatures[]= $feature;
}
return $this;
}
/**
* @param Feature $feature The feature object to add.
*/
protected function doAddFeature($feature)
{
$featureCategory = new FeatureCategory();
$featureCategory->setFeature($feature);
$this->addFeatureCategory($featureCategory);
}
/**
* Remove a Feature object to this object
* through the feature_category cross reference table.
*
* @param Feature $feature The FeatureCategory object to relate
* @return Category The current object (for fluent API support)
*/
public function removeFeature(Feature $feature)
{
if ($this->getFeatures()->contains($feature)) {
$this->collFeatures->remove($this->collFeatures->search($feature));
if (null === $this->featuresScheduledForDeletion) {
$this->featuresScheduledForDeletion = clone $this->collFeatures;
$this->featuresScheduledForDeletion->clear();
}
$this->featuresScheduledForDeletion[]= $feature;
}
return $this;
}
/**
* Clears out the collAttributes 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 Category The current object (for fluent API support)
* @see addAttributes()
*/
public function clearAttributes()
{
$this->collAttributes = null; // important to set this to null since that means it is uninitialized
$this->collAttributesPartial = null;
return $this;
}
/**
* Initializes the collAttributes collection.
*
* By default this just sets the collAttributes collection to an empty collection (like clearAttributes());
* 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 initAttributes()
{
$this->collAttributes = new PropelObjectCollection();
$this->collAttributes->setModel('Attribute');
}
/**
* Gets a collection of Attribute objects related by a many-to-many relationship
* to the current object by way of the attribute_category 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.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this Category is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria Optional query object to filter the query
* @param PropelPDO $con Optional connection object
*
* @return PropelObjectCollection|Attribute[] List of Attribute objects
*/
public function getAttributes($criteria = null, PropelPDO $con = null)
{
if (null === $this->collAttributes || null !== $criteria) {
if ($this->isNew() && null === $this->collAttributes) {
// return empty collection
$this->initAttributes();
} else {
$collAttributes = AttributeQuery::create(null, $criteria)
->filterByCategory($this)
->find($con);
if (null !== $criteria) {
return $collAttributes;
}
$this->collAttributes = $collAttributes;
}
}
return $this->collAttributes;
}
/**
* Sets a collection of Attribute objects related by a many-to-many relationship
* to the current object by way of the attribute_category 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 PropelCollection $attributes A Propel collection.
* @param PropelPDO $con Optional connection object
* @return Category The current object (for fluent API support)
*/
public function setAttributes(PropelCollection $attributes, PropelPDO $con = null)
{
$this->clearAttributes();
$currentAttributes = $this->getAttributes();
$this->attributesScheduledForDeletion = $currentAttributes->diff($attributes);
foreach ($attributes as $attribute) {
if (!$currentAttributes->contains($attribute)) {
$this->doAddAttribute($attribute);
}
}
$this->collAttributes = $attributes;
return $this;
}
/**
* Gets the number of Attribute objects related by a many-to-many relationship
* to the current object by way of the attribute_category cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param PropelPDO $con Optional connection object
*
* @return int the number of related Attribute objects
*/
public function countAttributes($criteria = null, $distinct = false, PropelPDO $con = null)
{
if (null === $this->collAttributes || null !== $criteria) {
if ($this->isNew() && null === $this->collAttributes) {
return 0;
} else {
$query = AttributeQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByCategory($this)
->count($con);
}
} else {
return count($this->collAttributes);
}
}
/**
* Associate a Attribute object to this object
* through the attribute_category cross reference table.
*
* @param Attribute $attribute The AttributeCategory object to relate
* @return Category The current object (for fluent API support)
*/
public function addAttribute(Attribute $attribute)
{
if ($this->collAttributes === null) {
$this->initAttributes();
}
if (!$this->collAttributes->contains($attribute)) { // only add it if the **same** object is not already associated
$this->doAddAttribute($attribute);
$this->collAttributes[]= $attribute;
}
return $this;
}
/**
* @param Attribute $attribute The attribute object to add.
*/
protected function doAddAttribute($attribute)
{
$attributeCategory = new AttributeCategory();
$attributeCategory->setAttribute($attribute);
$this->addAttributeCategory($attributeCategory);
}
/**
* Remove a Attribute object to this object
* through the attribute_category cross reference table.
*
* @param Attribute $attribute The AttributeCategory object to relate
* @return Category The current object (for fluent API support)
*/
public function removeAttribute(Attribute $attribute)
{
if ($this->getAttributes()->contains($attribute)) {
$this->collAttributes->remove($this->collAttributes->search($attribute));
if (null === $this->attributesScheduledForDeletion) {
$this->attributesScheduledForDeletion = clone $this->collAttributes;
$this->attributesScheduledForDeletion->clear();
}
$this->attributesScheduledForDeletion[]= $attribute;
}
return $this;
}
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -4285,6 +4936,21 @@ abstract class BaseCategory extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
if ($this->collProducts) {
foreach ($this->collProducts as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collFeatures) {
foreach ($this->collFeatures as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collAttributes) {
foreach ($this->collAttributes as $o) {
$o->clearAllReferences($deep);
}
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
@@ -4329,6 +4995,18 @@ abstract class BaseCategory extends BaseObject implements Persistent
$this->collCategoryVersions->clearIterator();
}
$this->collCategoryVersions = null;
if ($this->collProducts instanceof PropelCollection) {
$this->collProducts->clearIterator();
}
$this->collProducts = null;
if ($this->collFeatures instanceof PropelCollection) {
$this->collFeatures->clearIterator();
}
$this->collFeatures = null;
if ($this->collAttributes instanceof PropelCollection) {
$this->collAttributes->clearIterator();
}
$this->collAttributes = null;
}
/**

View File

@@ -12,6 +12,7 @@ use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Attribute;
use Thelia\Model\AttributeCategory;
use Thelia\Model\Category;
use Thelia\Model\CategoryI18n;
@@ -20,8 +21,10 @@ use Thelia\Model\CategoryQuery;
use Thelia\Model\CategoryVersion;
use Thelia\Model\ContentAssoc;
use Thelia\Model\Document;
use Thelia\Model\Feature;
use Thelia\Model\FeatureCategory;
use Thelia\Model\Image;
use Thelia\Model\Product;
use Thelia\Model\ProductCategory;
use Thelia\Model\Rewriting;
@@ -1370,6 +1373,57 @@ abstract class BaseCategoryQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CategoryVersion', '\Thelia\Model\CategoryVersionQuery');
}
/**
* Filter the query by a related Product object
* using the product_category table as cross reference
*
* @param Product $product the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CategoryQuery The current query, for fluid interface
*/
public function filterByProduct($product, $comparison = Criteria::EQUAL)
{
return $this
->useProductCategoryQuery()
->filterByProduct($product, $comparison)
->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 CategoryQuery 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 CategoryQuery 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

@@ -29,6 +29,8 @@ use Thelia\Model\ContentVersionPeer;
use Thelia\Model\ContentVersionQuery;
use Thelia\Model\Document;
use Thelia\Model\DocumentQuery;
use Thelia\Model\Folder;
use Thelia\Model\FolderQuery;
use Thelia\Model\Image;
use Thelia\Model\ImageQuery;
use Thelia\Model\Rewriting;
@@ -153,6 +155,11 @@ abstract class BaseContent extends BaseObject implements Persistent
protected $collContentVersions;
protected $collContentVersionsPartial;
/**
* @var PropelObjectCollection|Folder[] Collection to store aggregation of Folder objects.
*/
protected $collFolders;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -195,6 +202,12 @@ abstract class BaseContent extends BaseObject implements Persistent
*/
protected $enforceVersion = false;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $foldersScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
@@ -730,6 +743,7 @@ abstract class BaseContent extends BaseObject implements Persistent
$this->collContentVersions = null;
$this->collFolders = null;
} // if (deep)
}
@@ -877,6 +891,32 @@ abstract class BaseContent extends BaseObject implements Persistent
$this->resetModified();
}
if ($this->foldersScheduledForDeletion !== null) {
if (!$this->foldersScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->foldersScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($pk, $remotePk);
}
ContentFolderQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->foldersScheduledForDeletion = null;
}
foreach ($this->getFolders() as $folder) {
if ($folder->isModified()) {
$folder->save($con);
}
}
} elseif ($this->collFolders) {
foreach ($this->collFolders as $folder) {
if ($folder->isModified()) {
$folder->save($con);
}
}
}
if ($this->contentAssocsScheduledForDeletion !== null) {
if (!$this->contentAssocsScheduledForDeletion->isEmpty()) {
foreach ($this->contentAssocsScheduledForDeletion as $contentAssoc) {
@@ -3502,6 +3542,183 @@ abstract class BaseContent extends BaseObject implements Persistent
return $this;
}
/**
* Clears out the collFolders 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 Content The current object (for fluent API support)
* @see addFolders()
*/
public function clearFolders()
{
$this->collFolders = null; // important to set this to null since that means it is uninitialized
$this->collFoldersPartial = null;
return $this;
}
/**
* Initializes the collFolders collection.
*
* By default this just sets the collFolders collection to an empty collection (like clearFolders());
* 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 initFolders()
{
$this->collFolders = new PropelObjectCollection();
$this->collFolders->setModel('Folder');
}
/**
* Gets a collection of Folder objects related by a many-to-many relationship
* to the current object by way of the content_folder 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.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this Content is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria Optional query object to filter the query
* @param PropelPDO $con Optional connection object
*
* @return PropelObjectCollection|Folder[] List of Folder objects
*/
public function getFolders($criteria = null, PropelPDO $con = null)
{
if (null === $this->collFolders || null !== $criteria) {
if ($this->isNew() && null === $this->collFolders) {
// return empty collection
$this->initFolders();
} else {
$collFolders = FolderQuery::create(null, $criteria)
->filterByContent($this)
->find($con);
if (null !== $criteria) {
return $collFolders;
}
$this->collFolders = $collFolders;
}
}
return $this->collFolders;
}
/**
* Sets a collection of Folder objects related by a many-to-many relationship
* to the current object by way of the content_folder 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 PropelCollection $folders A Propel collection.
* @param PropelPDO $con Optional connection object
* @return Content The current object (for fluent API support)
*/
public function setFolders(PropelCollection $folders, PropelPDO $con = null)
{
$this->clearFolders();
$currentFolders = $this->getFolders();
$this->foldersScheduledForDeletion = $currentFolders->diff($folders);
foreach ($folders as $folder) {
if (!$currentFolders->contains($folder)) {
$this->doAddFolder($folder);
}
}
$this->collFolders = $folders;
return $this;
}
/**
* Gets the number of Folder objects related by a many-to-many relationship
* to the current object by way of the content_folder cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param PropelPDO $con Optional connection object
*
* @return int the number of related Folder objects
*/
public function countFolders($criteria = null, $distinct = false, PropelPDO $con = null)
{
if (null === $this->collFolders || null !== $criteria) {
if ($this->isNew() && null === $this->collFolders) {
return 0;
} else {
$query = FolderQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByContent($this)
->count($con);
}
} else {
return count($this->collFolders);
}
}
/**
* Associate a Folder object to this object
* through the content_folder cross reference table.
*
* @param Folder $folder The ContentFolder object to relate
* @return Content The current object (for fluent API support)
*/
public function addFolder(Folder $folder)
{
if ($this->collFolders === null) {
$this->initFolders();
}
if (!$this->collFolders->contains($folder)) { // only add it if the **same** object is not already associated
$this->doAddFolder($folder);
$this->collFolders[]= $folder;
}
return $this;
}
/**
* @param Folder $folder The folder object to add.
*/
protected function doAddFolder($folder)
{
$contentFolder = new ContentFolder();
$contentFolder->setFolder($folder);
$this->addContentFolder($contentFolder);
}
/**
* Remove a Folder object to this object
* through the content_folder cross reference table.
*
* @param Folder $folder The ContentFolder object to relate
* @return Content The current object (for fluent API support)
*/
public function removeFolder(Folder $folder)
{
if ($this->getFolders()->contains($folder)) {
$this->collFolders->remove($this->collFolders->search($folder));
if (null === $this->foldersScheduledForDeletion) {
$this->foldersScheduledForDeletion = clone $this->collFolders;
$this->foldersScheduledForDeletion->clear();
}
$this->foldersScheduledForDeletion[]= $folder;
}
return $this;
}
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -3573,6 +3790,11 @@ abstract class BaseContent extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
if ($this->collFolders) {
foreach ($this->collFolders as $o) {
$o->clearAllReferences($deep);
}
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
@@ -3609,6 +3831,10 @@ abstract class BaseContent extends BaseObject implements Persistent
$this->collContentVersions->clearIterator();
}
$this->collContentVersions = null;
if ($this->collFolders instanceof PropelCollection) {
$this->collFolders->clearIterator();
}
$this->collFolders = null;
}
/**

View File

@@ -20,6 +20,7 @@ use Thelia\Model\ContentPeer;
use Thelia\Model\ContentQuery;
use Thelia\Model\ContentVersion;
use Thelia\Model\Document;
use Thelia\Model\Folder;
use Thelia\Model\Image;
use Thelia\Model\Rewriting;
@@ -1133,6 +1134,23 @@ abstract class BaseContentQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'ContentVersion', '\Thelia\Model\ContentVersionQuery');
}
/**
* Filter the query by a related Folder object
* using the content_folder table as cross reference
*
* @param Folder $folder the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ContentQuery The current query, for fluid interface
*/
public function filterByFolder($folder, $comparison = Criteria::EQUAL)
{
return $this
->useContentFolderQuery()
->filterByFolder($folder, $comparison)
->endUse();
}
/**
* Exclude object from result
*

View File

@@ -15,6 +15,8 @@ use \PropelDateTime;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Category;
use Thelia\Model\CategoryQuery;
use Thelia\Model\Feature;
use Thelia\Model\FeatureAv;
use Thelia\Model\FeatureAvQuery;
@@ -110,6 +112,11 @@ abstract class BaseFeature extends BaseObject implements Persistent
protected $collFeatureI18ns;
protected $collFeatureI18nsPartial;
/**
* @var PropelObjectCollection|Category[] Collection to store aggregation of Category objects.
*/
protected $collCategorys;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -144,6 +151,12 @@ abstract class BaseFeature extends BaseObject implements Persistent
*/
protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $categorysScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
@@ -527,6 +540,7 @@ abstract class BaseFeature extends BaseObject implements Persistent
$this->collFeatureI18ns = null;
$this->collCategorys = null;
} // if (deep)
}
@@ -662,6 +676,32 @@ abstract class BaseFeature extends BaseObject implements Persistent
$this->resetModified();
}
if ($this->categorysScheduledForDeletion !== null) {
if (!$this->categorysScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->categorysScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($remotePk, $pk);
}
FeatureCategoryQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->categorysScheduledForDeletion = null;
}
foreach ($this->getCategorys() as $category) {
if ($category->isModified()) {
$category->save($con);
}
}
} elseif ($this->collCategorys) {
foreach ($this->collCategorys as $category) {
if ($category->isModified()) {
$category->save($con);
}
}
}
if ($this->featureAvsScheduledForDeletion !== null) {
if (!$this->featureAvsScheduledForDeletion->isEmpty()) {
FeatureAvQuery::create()
@@ -2245,6 +2285,183 @@ abstract class BaseFeature extends BaseObject implements Persistent
return $this;
}
/**
* Clears out the collCategorys 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 Feature The current object (for fluent API support)
* @see addCategorys()
*/
public function clearCategorys()
{
$this->collCategorys = null; // important to set this to null since that means it is uninitialized
$this->collCategorysPartial = null;
return $this;
}
/**
* Initializes the collCategorys collection.
*
* By default this just sets the collCategorys collection to an empty collection (like clearCategorys());
* 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 initCategorys()
{
$this->collCategorys = new PropelObjectCollection();
$this->collCategorys->setModel('Category');
}
/**
* Gets 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.
*
* 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.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this Feature is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria Optional query object to filter the query
* @param PropelPDO $con Optional connection object
*
* @return PropelObjectCollection|Category[] List of Category objects
*/
public function getCategorys($criteria = null, PropelPDO $con = null)
{
if (null === $this->collCategorys || null !== $criteria) {
if ($this->isNew() && null === $this->collCategorys) {
// return empty collection
$this->initCategorys();
} else {
$collCategorys = CategoryQuery::create(null, $criteria)
->filterByFeature($this)
->find($con);
if (null !== $criteria) {
return $collCategorys;
}
$this->collCategorys = $collCategorys;
}
}
return $this->collCategorys;
}
/**
* 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.
* 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 PropelCollection $categorys A Propel collection.
* @param PropelPDO $con Optional connection object
* @return Feature The current object (for fluent API support)
*/
public function setCategorys(PropelCollection $categorys, PropelPDO $con = null)
{
$this->clearCategorys();
$currentCategorys = $this->getCategorys();
$this->categorysScheduledForDeletion = $currentCategorys->diff($categorys);
foreach ($categorys as $category) {
if (!$currentCategorys->contains($category)) {
$this->doAddCategory($category);
}
}
$this->collCategorys = $categorys;
return $this;
}
/**
* Gets the number of Category objects related by a many-to-many relationship
* to the current object by way of the feature_category cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param PropelPDO $con Optional connection object
*
* @return int the number of related Category objects
*/
public function countCategorys($criteria = null, $distinct = false, PropelPDO $con = null)
{
if (null === $this->collCategorys || null !== $criteria) {
if ($this->isNew() && null === $this->collCategorys) {
return 0;
} else {
$query = CategoryQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByFeature($this)
->count($con);
}
} else {
return count($this->collCategorys);
}
}
/**
* Associate a Category object to this object
* through the feature_category cross reference table.
*
* @param Category $category The FeatureCategory object to relate
* @return Feature The current object (for fluent API support)
*/
public function addCategory(Category $category)
{
if ($this->collCategorys === null) {
$this->initCategorys();
}
if (!$this->collCategorys->contains($category)) { // only add it if the **same** object is not already associated
$this->doAddCategory($category);
$this->collCategorys[]= $category;
}
return $this;
}
/**
* @param Category $category The category object to add.
*/
protected function doAddCategory($category)
{
$featureCategory = new FeatureCategory();
$featureCategory->setCategory($category);
$this->addFeatureCategory($featureCategory);
}
/**
* Remove a Category object to this object
* through the feature_category cross reference table.
*
* @param Category $category The FeatureCategory object to relate
* @return Feature The current object (for fluent API support)
*/
public function removeCategory(Category $category)
{
if ($this->getCategorys()->contains($category)) {
$this->collCategorys->remove($this->collCategorys->search($category));
if (null === $this->categorysScheduledForDeletion) {
$this->categorysScheduledForDeletion = clone $this->collCategorys;
$this->categorysScheduledForDeletion->clear();
}
$this->categorysScheduledForDeletion[]= $category;
}
return $this;
}
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -2298,6 +2515,11 @@ abstract class BaseFeature extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
if ($this->collCategorys) {
foreach ($this->collCategorys as $o) {
$o->clearAllReferences($deep);
}
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
@@ -2322,6 +2544,10 @@ abstract class BaseFeature extends BaseObject implements Persistent
$this->collFeatureI18ns->clearIterator();
}
$this->collFeatureI18ns = null;
if ($this->collCategorys instanceof PropelCollection) {
$this->collCategorys->clearIterator();
}
$this->collCategorys = null;
}
/**

View File

@@ -12,6 +12,7 @@ use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Category;
use Thelia\Model\Feature;
use Thelia\Model\FeatureAv;
use Thelia\Model\FeatureCategory;
@@ -770,6 +771,23 @@ abstract class BaseFeatureQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'FeatureI18n', '\Thelia\Model\FeatureI18nQuery');
}
/**
* Filter the query by a related Category object
* using the feature_category table as cross reference
*
* @param Category $category the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return FeatureQuery The current query, for fluid interface
*/
public function filterByCategory($category, $comparison = Criteria::EQUAL)
{
return $this
->useFeatureCategoryQuery()
->filterByCategory($category, $comparison)
->endUse();
}
/**
* Exclude object from result
*

View File

@@ -15,8 +15,10 @@ use \PropelDateTime;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Content;
use Thelia\Model\ContentFolder;
use Thelia\Model\ContentFolderQuery;
use Thelia\Model\ContentQuery;
use Thelia\Model\Document;
use Thelia\Model\DocumentQuery;
use Thelia\Model\Folder;
@@ -157,6 +159,11 @@ abstract class BaseFolder extends BaseObject implements Persistent
protected $collFolderVersions;
protected $collFolderVersionsPartial;
/**
* @var PropelObjectCollection|Content[] Collection to store aggregation of Content objects.
*/
protected $collContents;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -199,6 +206,12 @@ abstract class BaseFolder extends BaseObject implements Persistent
*/
protected $enforceVersion = false;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $contentsScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
@@ -790,6 +803,7 @@ abstract class BaseFolder extends BaseObject implements Persistent
$this->collFolderVersions = null;
$this->collContents = null;
} // if (deep)
}
@@ -937,6 +951,32 @@ abstract class BaseFolder extends BaseObject implements Persistent
$this->resetModified();
}
if ($this->contentsScheduledForDeletion !== null) {
if (!$this->contentsScheduledForDeletion->isEmpty()) {
$pks = array();
$pk = $this->getPrimaryKey();
foreach ($this->contentsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
$pks[] = array($remotePk, $pk);
}
ContentFolderQuery::create()
->filterByPrimaryKeys($pks)
->delete($con);
$this->contentsScheduledForDeletion = null;
}
foreach ($this->getContents() as $content) {
if ($content->isModified()) {
$content->save($con);
}
}
} elseif ($this->collContents) {
foreach ($this->collContents as $content) {
if ($content->isModified()) {
$content->save($con);
}
}
}
if ($this->imagesScheduledForDeletion !== null) {
if (!$this->imagesScheduledForDeletion->isEmpty()) {
foreach ($this->imagesScheduledForDeletion as $image) {
@@ -3288,6 +3328,183 @@ abstract class BaseFolder extends BaseObject implements Persistent
return $this;
}
/**
* Clears out the collContents 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 Folder The current object (for fluent API support)
* @see addContents()
*/
public function clearContents()
{
$this->collContents = null; // important to set this to null since that means it is uninitialized
$this->collContentsPartial = null;
return $this;
}
/**
* Initializes the collContents collection.
*
* By default this just sets the collContents collection to an empty collection (like clearContents());
* 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 initContents()
{
$this->collContents = new PropelObjectCollection();
$this->collContents->setModel('Content');
}
/**
* Gets a collection of Content objects related by a many-to-many relationship
* to the current object by way of the content_folder 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.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this Folder is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria Optional query object to filter the query
* @param PropelPDO $con Optional connection object
*
* @return PropelObjectCollection|Content[] List of Content objects
*/
public function getContents($criteria = null, PropelPDO $con = null)
{
if (null === $this->collContents || null !== $criteria) {
if ($this->isNew() && null === $this->collContents) {
// return empty collection
$this->initContents();
} else {
$collContents = ContentQuery::create(null, $criteria)
->filterByFolder($this)
->find($con);
if (null !== $criteria) {
return $collContents;
}
$this->collContents = $collContents;
}
}
return $this->collContents;
}
/**
* Sets a collection of Content objects related by a many-to-many relationship
* to the current object by way of the content_folder 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 PropelCollection $contents A Propel collection.
* @param PropelPDO $con Optional connection object
* @return Folder The current object (for fluent API support)
*/
public function setContents(PropelCollection $contents, PropelPDO $con = null)
{
$this->clearContents();
$currentContents = $this->getContents();
$this->contentsScheduledForDeletion = $currentContents->diff($contents);
foreach ($contents as $content) {
if (!$currentContents->contains($content)) {
$this->doAddContent($content);
}
}
$this->collContents = $contents;
return $this;
}
/**
* Gets the number of Content objects related by a many-to-many relationship
* to the current object by way of the content_folder cross-reference table.
*
* @param Criteria $criteria Optional query object to filter the query
* @param boolean $distinct Set to true to force count distinct
* @param PropelPDO $con Optional connection object
*
* @return int the number of related Content objects
*/
public function countContents($criteria = null, $distinct = false, PropelPDO $con = null)
{
if (null === $this->collContents || null !== $criteria) {
if ($this->isNew() && null === $this->collContents) {
return 0;
} else {
$query = ContentQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByFolder($this)
->count($con);
}
} else {
return count($this->collContents);
}
}
/**
* Associate a Content object to this object
* through the content_folder cross reference table.
*
* @param Content $content The ContentFolder object to relate
* @return Folder The current object (for fluent API support)
*/
public function addContent(Content $content)
{
if ($this->collContents === null) {
$this->initContents();
}
if (!$this->collContents->contains($content)) { // only add it if the **same** object is not already associated
$this->doAddContent($content);
$this->collContents[]= $content;
}
return $this;
}
/**
* @param Content $content The content object to add.
*/
protected function doAddContent($content)
{
$contentFolder = new ContentFolder();
$contentFolder->setContent($content);
$this->addContentFolder($contentFolder);
}
/**
* Remove a Content object to this object
* through the content_folder cross reference table.
*
* @param Content $content The ContentFolder object to relate
* @return Folder The current object (for fluent API support)
*/
public function removeContent(Content $content)
{
if ($this->getContents()->contains($content)) {
$this->collContents->remove($this->collContents->search($content));
if (null === $this->contentsScheduledForDeletion) {
$this->contentsScheduledForDeletion = clone $this->collContents;
$this->contentsScheduledForDeletion->clear();
}
$this->contentsScheduledForDeletion[]= $content;
}
return $this;
}
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -3356,6 +3573,11 @@ abstract class BaseFolder extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
if ($this->collContents) {
foreach ($this->collContents as $o) {
$o->clearAllReferences($deep);
}
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
@@ -3388,6 +3610,10 @@ abstract class BaseFolder extends BaseObject implements Persistent
$this->collFolderVersions->clearIterator();
}
$this->collFolderVersions = null;
if ($this->collContents instanceof PropelCollection) {
$this->collContents->clearIterator();
}
$this->collContents = null;
}
/**

View File

@@ -12,6 +12,7 @@ use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Content;
use Thelia\Model\ContentFolder;
use Thelia\Model\Document;
use Thelia\Model\Folder;
@@ -1133,6 +1134,23 @@ abstract class BaseFolderQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'FolderVersion', '\Thelia\Model\FolderVersionQuery');
}
/**
* Filter the query by a related Content object
* using the content_folder table as cross reference
*
* @param Content $content the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return FolderQuery The current query, for fluid interface
*/
public function filterByContent($content, $comparison = Criteria::EQUAL)
{
return $this
->useContentFolderQuery()
->filterByContent($content, $comparison)
->endUse();
}
/**
* Exclude object from result
*

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